Accounts

Overview

Account management provides a wide range of usage for players and admin. As a player, this feature ensures that you will have full control of your own data like maintaining your account information, requesting a password reset, deactivating account and downloading all of your data from the system if needed. As an admin, you will have more control of your players data, for example you can see the users order history or their activity updates. In some cases, you may need to disable an account due to some violation of your terms and conditions.

Things to Know

Before you can manage user accounts, you need to know how to register and verify new accounts.

  1. Registering User Account
  2. Verifying User Account

Registering a User Account

To register a user account, the user needs to provide an email address and password.

How to Register a User Account

private static void OnRegister(Result<UserData> result)
{
if (result.IsError)
{
Debug.Log("Register failed:", result.Error.Message);
}
else
{
Debug.Log("Register successful.");
}
}
public static void Main(string[] args)
{
var user = AccelBytePlugin.GetUser();
string email = "useremail@example.com";
string password = "password";
string displayName = "displayed";
string country = "US";
string dateOfBirth = "1995-12-30";
user.Register(email, password, displayName, OnRegister, country, dateOfBirth);
}
const FString OriginalEmail = TEXT("originalEmail@example.com");
const FString Password = TEXT("password");
const FString DisplayName = TEXT("testName");
const FString Country = TEXT("US");
const FString DateOfBirth = TEXT("2000-12-20");
bool bUserAccountCreated = false;
FRegistry::User.Register(OriginalEmail, Password, DisplayName, Country, DateOfBirth,
THandler<FUserData>::CreateLambda([&bUserAccountCreated](const FUserData& Result)
{
UE_LOG(LogAccelByteUserTest, Display, TEXT("Success."));
bUserAccountCreated = true;
}),
FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogAccelByteUserTest, Fatal, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
}));

Verifying User Accounts

After an account has been registered, it needs to be verified before it can log in.

How to Verify User Accounts

Usage:

//Let's assume that user has inputted verification code somehow after receiving email with verification code
private static void OnVerifyClicked(object sender, string verificationCode)
{
var user = AccelBytePlugin.GetUser();
user.Verify(verificationCode, OnVerify);
}
private static void OnVerify(Result result)
{
if (result.IsError)
{
Debug.Log("Verify failed:", result.Error.Message);
}
else
{
Debug.Log("Verify successful. User verified");
}
}

Headless Account

How to Send Verification Code to User

Before upgrading a headless account, a verification code must be sent to the user's email address. Use the Send verification code to user: POST /iam/v3/public/namespaces/{namespace}/users/me/code/request.

Available contexts for use:

ContextUsage
UserAccountRegistrationVerifying an email address for user account management
UpdateEmailAddressVerifying a user before updating their email address
upgradeHeadlessAccountAutomatically verified email address

In this case, choose the upgradeHeadlessAccount context. Follow these steps to make the request:

  1. Input the Namespace
  2. Fill in the Request Body:
    • Input the appropriate context into the Context field.
    • Input user’s Email Address.
    • Input user’s Language Tag account.
  3. Click Try it out!

Tutorials

How to Recover an Account

Step 1: Request the Password Reset Code

To get the password reset code, Use the Request Password Reset Code: POST /iam/v3/public/namespaces/{namespace}/users/forgot endpoint and follow these steps to make request:

  1. Input the game’s namespace into the Namespace field.
  2. Fill the Request Body:
    • Input user’s Email Address.
    • Input Language Tag.
  3. Click Try it out!

Step 2: Reset the User’s Password

Use the Reset User Password: POST /iam/v3/public/namespaces/{namespace}/users/reset endpoint. Follow these steps to make the request:

  1. Input the Namespace
  2. Fill the Request Body:
    • Input Code with the password reset code retrieved from the previous step.
    • Input user’s Email Address.
    • Input the Language Tag.
  3. Click Try it out!

Note:

  • Namespace only accepts alphanumeric characters.
  • Fill the Language Tag with the language to be used in the email.

Upgrade a Headless Account

Upgrade a Headless Account with a Verification Code

Admin: Upgrade Headless Account with a Verification Code

This feature enables admins to upgrade a player’s account with the Verification Code sent to their email. Use the Upgrade Headless Account with Verification Code: POST /iam/v3/admin/namespaces/{namespace}/users/{userId}/headless/code/verify endpoint. Follow these steps to make the request:

  1. Input the game’s namespace into the Namespace field.
  2. Input the player’s user ID into the User ID field.
  3. Fill out the Request Body:
    • Input the verification code into the Code field.
    • Input user’s Email Address.
    • Input user’s Password account.
  4. Click Try it out!

Note:

  • User ID should follow the UUID version 4 without hyphen.
Player: Upgrade Headless Account with Verification Code

Upgrade a headless account by linking the headless account with the email address and password, after a successful request the account will automatically verify the email address. Use the Upgrade headless account and automatically verified the email address if it is succeeded: POST /iam/v3/public/namespaces/{namespace}/users/me/headless/code/verify endpoint. Follow these steps to make the request:

  1. Input the Namespace
  2. Input the User ID
  3. Fill out the Request Body:
    • Input Code with the verification code.
    • Input user’s Email Address.
    • Input user’s Password account.
  4. Click Try it out!

Create a New Player

Creating a new player can be done through API or Player Portal.

How to Create a New Player with API

Use the Create User: POST /iam/v3/public/namespaces/{namespace}/users endpoint. Follow these steps to make the request:

  1. Input the game’s namespace into the Namespace field.
  2. Fill in the Request Body:
    • Input the Authentication Type (authType) with the appropriate authentication type, in this case EMAILPASSWD.
    • Input the player’s country into the Country field, using ISO 3166-1 alpha 2 two letter format, e.g. US.
    • Input the players’s date of birth into the Date of Birth field, using YYYY-MM-DD format, e.g. 2019-04-29.
    • Input user’s Display Name
    • Input user’s Email Address
    • Input user’s Password
  3. Click Try it out!

How to Create a New Player with the Player Portal

Step 1: Go to the Player Portal.

uam

Step 2: Click Create a New Account.

uam

Step 3: Fill out the Registration Form.

uam

Step 4: Log into the Account.

uam

Step 5: Enter Verification Code.

After successfully logging into the account, users need to enter the verification code sent to their email.

uam

Step 6: Registration is complete!

uam

Create a Game Account

A game account will automatically be created once the client logs into the game namespace. The login process involves two endpoints, listed below. Click the links to read more about these two endpoints:

Create a New Admin User

Creating a new admin user can be done using API or through the Admin Portal.

Create a New Admin User with API

There are two steps to create a new admin user using API. Follow these steps to make the request.

Step 1: Create a New User First, use the Create User: POST /iam/v3/public/namespaces/{namespace}/users endpoint.

  1. Input the namespace you want the new user to be admin of in the Namespace field.
  2. Fill out the Request Body:
    • Input the Authentication Type (authType) with the appropriate authentication type, in this case EMAILPASSWD.
    • Input the player’s country into the Country field, using ISO 3166-1 alpha 2 two letter format, e.g. US.
    • Input the players’s date of birth into the Date of Birth field, using YYYY-MM-DD format, e.g. 2019-04-29.
    • Input user’s Display Name
    • Input user’s Email Address
    • Input user’s Password
  3. Click Try it out!

Step 2: Assign the User to an Admin Role To assign the newly created user to an admin role, use the Add User Role: POST /iam/v3/admin/namespaces/{namespace}/users/{userId}/roles/{roleId} endpoint.

  1. Input the appropriate namespace in the Namespace field.
  2. Input the user’s ID into the User ID field.
  3. Input the appropriate Role ID, using UUID 4 formatting without hyphens.

Create a New Admin User through the Admin Portal

  1. Login to Admin Portal using valid credentials. After successful login, you’ll be directed to the dashboard.

uam

  1. Click the Users menu in the sidebar

uam

  1. Click the Create New button
  2. Input the required content in the form

uam

Create a New Read-Only Publisher Admin User

Create a New Read-Only Publisher Admin User Using the API Gateway

There are two steps in creating a read-only publisher admin.

Step 1: Create a New User Use the Create User: POST /iam/v3/public/namespaces/{namespace}/users endpoint. Follow these steps to make request:

  1. Input the appropriate namespace into the Namespace field.
  2. Fill out the Request Body:
    • Input the Authentication Type (authType) with available authentication types.
    • Input the user’s country into the Country field, using ISO 3166-1 alpha 2 two letter format, e.g. US.
    • Input the user’s date of birth into the Date of Birth field, using YYYY-MM-DD format, e.g. 2019-04-29.
    • Input user’s Display Name
    • Input user’s Email Address
    • Input user’s Password
  3. Click Try it out!

Step 2: Assign User as Read-Only Publisher Admin Use the Add User Role: POST /iam/v3/admin/namespaces/{namespace}/users/{userId}/roles/{roleId} endpoint. Follow these steps to make request:

  1. Input the appropriate namespace into the Namespace.
  2. Input the User ID.
  3. Input the appropriate Role ID.
  4. Click Try it out!

Create a New Read-Only Publisher Admin User Through the Admin Portal

  1. Login to Admin Portal using valid credentials. After successful login, you’ll be directed to the dashboard.

uam

  1. Click the Users menu in the sidebar.

uam

  1. Click the Create New button.

  2. Input the required information into the form below.

    uam

    • Find the user you’ve just created by typing their email or display name in the search bar.

uam

  1. Once the desired user is found, Click the View button.

uam

  1. Switch to the Roles tab and Click the Add button.

uam

  1. Click the Choose Roles dropdown and choose the desired role. In this case choose the Admin Portal Read Only.

uam

  1. Once it’s done the new roles will be added in the list.

uam

Create a New Super Admin User For the Publisher

Creating a new super admin user for your publisher is similar to creating a new read-only publisher. Follow these steps to create a new super admin user.

  1. Login to Admin Portal using valid credentials. After successful login, you’ll be directed to the dashboard.

uam

  1. Click the Users menu in the sidebar.

uam

  1. Click the Create New button.

  2. Input the required information into the form below.

    uam

    • Find the user you’ve just created by typing their email or display name in the search bar.

uam

  1. Once the desired user is found, Click the View button.

uam

  1. Switch to the Roles tab and Click the Add button.

uam

  1. When choosing the role in the admin portal, choose the Admin Portal Super User role.

uam

  1. Once it’s done the new roles will be added in the list.

uam

Add a Permission to a User

Things to Know

Action Values

Each action is assigned a numerical value. You’ll need these values when you create a request.

ValuePurpose
1Create
2Read
4Update
8Delete

You can use multiple values to grant users access to multiple actions.

Adding User Permission Using API Gateway

Use the Users: Add User Permission - POST /iam/v3/admin/namespaces/{namespace}/users/{userId}/permissions endpoint to make a request.

  1. Input the user’s namespace in the Namespace field.

  2. Input the user’s ID in the User ID field.

  3. Fill out the Request Body:

    • Input the Action needed for the permission.
    • Input the resource you want to access into the Resource parameter. Note that the Resource parameter has its own formatting requirements, listed below:
      • Only uppercase letters and numbers can be used, except in the variable section
      • Variable placeholders should be wrapped with {}
      • Uppercase and lowercase letters are both allowed for the variable placeholder
      • Variable placeholders can be replaced with * as the value or alphanumeric only string

    The following parameters are optional; they can be used to schedule permissions that are granted on a temporary basis.

    • Input the desired action value into the SchedAction field.
    • For recurring permissions, input the desired string or date range in UTC into the SchedCron field.
    • Input the start and end dates for the permission into the SchedRange field.
  4. Click Try it out!

After a successful request, the permission will be added to the user.

Add User Permissions Through the Admin Portal

Follow these steps to add user permission through the admin portal:

  1. Go to the Platform Configuration section.

uam

  1. Click the Roles menu.
  2. Find the Roles in the Role Name section. Once it’s found click View.

uam

  1. Once the View button clicked this page will appear.

uam

  1. Go to the User Permissions section and click the Add button.
    • Input the resource to be accessed by the permission into the Resource field, using the appropriate format. e.g. PERMISSION:{variable}:NAMESPACE:AccelByte:RESOURCE:*
    • Select the desired Action. You can select more than one action.

uam

  1. Click the Confirm button once it’s done.
  2. After it’s done, the new Resource will be added in the list.

Getting User Data

Getting user data retrieves all of the personal data for a specific player.

public static void OnGetUserData(Result<UserData> result)
{
if (result.IsError)
{
Debug.Log("Get data failed:", result.Error.Message);
}
else
{
Debug.Log("Get data successful.");
}
}
public static void Main(string[] args)
{
var user = AccelBytePlugin.GetUser();
user.GetData(OnGetUserData);
}
bool bGetDataSuccessful1 = false;
FUserData GetDataResult;
FRegistry::User.GetData(
THandler<FUserData>::CreateLambda([&](const FUserData& Result)
{
UE_LOG(LogAccelByteUserTest, Log, TEXT("Success"));
bGetDataSuccessful = true;
GetDataResult = Result;
}),
FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogAccelByteUserTest, Fatal, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
}));

Updating a User’s Attributes

You can update player attributes such as display name, language tag, or country.

static string email = "johnDoe@example.com";
static string password = "freshPassword1";
public static void OnLogin(Result result)
{
if (!result.IsError)
{
var user = AccelBytePlugin.GetUser();
var updateRequest = new UpdateUserRequest
{
Country = "US",
DisplayName = "exampleDisplayName"
};
user.Update(updateRequest, OnUpdate);
}
else
{
Debug.Log("Reset Password Failed.");
}
}
public static void OnUpdate(Result<UserData> result)
{
if (!result.IsError)
{
Debug.Log("User account has been updated.");
}
else
{
Debug.Log("User account update failed.");
}
}
public static void Main(string[] args)
{
user.LoginWithUserName(email, password, OnLogin);
}
// Not implemented yet

What’s Next?

  • For more information about User Account Management you can access the API references.