Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

User authentication

turupawn edited this page Jul 14, 2020 · 14 revisions

We authenticate users via a simple email verification flow - which is used to generate OAuth 2 access tokens. A user can manage the tokens they have been issued via their OAuth 2 token page.

Email authentication flow

Authentication occurs by asking for their email and then for the 5-digit security code sent to their email. To do so, first call emailRequest to send the email and then emailExchange to exchange the security code for an access token that will be handled internally by the SDK so you won't need to deal with it.

Functions

ModioEmailRequest

API endpoint: Authentincation

Request a security_code be sent to the email address of the user you wish to authenticate.

email_request

Input

Name Type Description
Email FString A valid and secure email address your user has access to.

Output

Name Type Description
Response FModioResponse FModioResponse object that contains the mod.io response status.

C++ example

Modio->EmailRequest("[email protected]", FModioGenericDelegate::CreateUObject(ModioManager, &UModioManager::OnEmailRequest));

// ...

void UModioManager::OnEmailRequest(FModioResponse Response)
{
  // Response.code should be 200 if an security code was sent to the provided email
}

ModioEmailExchange

API endpoint: Authentincation

Exchanges the 5-digit code for an authentication token. The token is handled internally by the SDK.

email_exchange

Input

Name Type Description
security_code FString Unique 5-digit code sent to the email address supplied in the previous request..

Output

Name Type Description
Response FModioResponse FModioResponse object that contains the mod.io response status.

C++ example

Modio->EmailExchange("VBY5A", FModioGenericDelegate::CreateUObject(ModioManager, &UModioManager::OnEmailExchange));

// ...

void UModioManager::OnEmailExchange(FModioResponse Response)
{
  // Response.code should be 200 if you are now authenticated
}

ModioIsLoggedIn

Returns true if the user is logged in, otherwise returns false.

is_logged_in

ModioLogout

Logs out the user from mod.io.

logout