-
Notifications
You must be signed in to change notification settings - Fork 27
User Authentication (C compatible)
void modioEmailRequest(void* object, char* email, void (*callback)(void* object, ModioResponse response));
API endpoint used: Email Request
C++ wrapper: User Authentication#emailrequest
Requests a 5-digit security code to be sent via email. emailExchange should be called after to complete the authentication process.
Name | Type | Description |
---|---|---|
object | void* |
Context parameter. |
char* |
User's email. | |
callback | void (*callback)(void* object, ModioResponse response) |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
object | void* |
Context parameter. |
response | ModioResponse |
ModioResponse object that contains the mod.io response status. |
void onEmailRequest(void* object, ModioResponse response)
{
if(response.code == 200)
{
//Email requested successfully
}
}
[...]
modioEmailRequest(NULL,"example@mail.com",&onEmailRequest);
void modioEmailExchange(void* object, char* security_code, void (*callback)(void* object, ModioResponse response));
API endpoint used: Email Exchange
C++ wrapper: User Authentication#emailexchange
Exchanges the 5-digit code for an authentication token. The token is handled internally by the SDK.
Name | Type | Description |
---|---|---|
object | void* |
Context parameter. |
security_code | char* |
5-digit code sent to users via email when emailRequest was called. |
callback | void (*callback)(void* object, ModioResponse response) |
Function called once the process finished. |
Name | Type | Description |
---|---|---|
response | ModioResponse |
ModioResponse object that contains the mod.io response status |
void onExchange(void* object, ModioResponse response)
{
if(response.code == 200)
{
//Code exchanged successfully
}
}
[...]
modioEmailExchange(NULL, "5UI23", &onExchange);
void modioAuthenticateViaToken(char const* access_token);
C++ wrapper: User Authentication#authenticateviatoken
Authenticates the user by providing a valid mod.io token directly.
Name | Type | Description |
---|---|---|
access_token | char const* |
mod.io user authentication token. |
modioAuthenticateViaToken("eykger...lkw421");
bool modioIsLoggedIn();
C++ wrapper: User Authentication#isloggedin
Returns true if the user is logged in, otherwise returns false.
const struct ModioUser modioGetCurrentUser();
Returns a ModioUser object corresponding to the current user logged in.
if(modioIsLoggedIn())
{
printf("Logged in as %s\n", modioGetCurrentUser().username);
}else
{
printf("You are not logged in.\n");
}
void modioLogout();
C++ wrapper: User Authentication#logout
Logs out the user from mod.io.
- Home
- Table of Contents
- Getting Started
- SDK Methods
- Creators
- Editors
- Schemas
- modio::Avatar
- modio::Comment
- modio::Dependency
- modio::Download
- modio::Error
- modio::Filehash
- modio::Game
- modio::GameTagOption
- modio::Header
- modio::Icon
- modio::Image
- modio::InstalledMod
- modio::Logo
- modio::Media
- modio::MetadataKVP
- modio::Mod
- modio::ModEvent
- modio::Modfile
- modio::QueuedModDownload
- modio::QueuedModfileUpload
- modio::Rating
- modio::Response
- modio::Stats
- modio::Tag
- modio::User
- Debugging
- Constants
-
C Compatibility
- Methods
- Initialization, Process and Shutdown (C compatible)
- User Authentication (C compatible)
- Mods (C compatible)
- Modfiles (C compatible)
- Media (C compatible)
- Subscriptions (C compatible)
- Events (C compatible)
- Stats (C compatible)
- Tags (C compatible)
- Ratings (C compatible)
- Metadata KVP (C compatible)
- Dependencies (C compatible)
- Comments (C compatible)
- Reports (C compatible)
- Me (C compatible)
- Downloads (C compatible)
- Uploads (C compatible)
- Logs (C compatible)
- External Auth (C compatible)
- Configuration (C compatible)
- Creators
- Editors
- Schemas
- ModioAvatar
- ModioComment
- ModioDependency
- ModioDownload
- ModioError
- ModioFilehash
- ModioGame
- ModioGameTagOption
- ModioHeader
- ModioIcon
- ModioImage
- ModioInstalledMod
- ModioListNode
- ModioLogo
- ModioMedia
- ModioMetadataKVP
- ModioMod
- ModioModEvent
- ModioModfile
- ModioQueuedModDownload
- ModioQueuedModfileUpload
- ModioRating
- ModioResponse
- ModioStats
- ModioTag
- ModioUser
- Methods
- Building