User management

Learn about advanced setups from our how-tos.

Notice
Use this how-to when working with the Login library.

How to work with user attributes

You can use attributes to manage additional information about the users of your application. The user attribute is a key-value pair. The Login library supports the following types of attributes:

  • User-editable attributes. The values for this type of attributes are entered by a user or specified according to the in-game logics on the client side. For example: the name and character stats, game difficulty level, etc.

  • Read-only attributes. The values for this type of attributes are entered and edited on the server side of your application. We recommend you use them for configuration of game character stats or user parameters that shouldn’t be changed a lot. For example: use them for the chance to get a bonus, game character key parameters, user categories, etc.

To manage user attributes, use the following SDK methods:

  • XLogin.getUsersAttributesFromClient — gets a list of attributes for a specific user.
  • XLogin.updateUsersAttributesFromClient — updates and creates attributes of a specific user.

When working with read-only attributes, you can use a server token or a Publisher Account token for authorization.

To get the Publisher Account token:

  1. Enter your Publisher Account.
  2. Go to the cookie files viewpage via the developers’ tools in your browser.
  3. Copy the value from the pa-v4-token parameter and paste it to the Authorization header.

Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Hide

How to work with user account in your application

Users can configure the following data from a user account:

  • public profile data:
    • avatar
    • nickname

  • personal user data:
    • name and surname
    • birthdate
    • gender
    • phone number
    • email

Note
You can add the friend list management functionality in the user account if the friend system is implemented in the application.

You can manage the user account via the API calls. The Login library has the following methods implemented:

  • XLogin.getCurrentUserDetails — gets the user’s data.
  • XLogin.updateCurrentUserDetails — updates the user’s data.

Note
The user can set their birthdate only once. The entered value can’t be changed in the future.

  • XLogin.getCurrentUserEmail — gets the user’s email address.
  • XLogin.getCurrentUserPhone — gets the user’s phone number.
  • XLogin.updateCurrentUserPhone — updates the user’s phone number.
  • XLogin.deleteCurrentUserPhone — deletes the user’s phone number.
  • XLogin.uploadCurrentUserAvatar — changes the user’s avatar.
  • XLogin.deleteCurrentUserAvatar — deletes the user’s avatar.

You can see the examples of the method calls in the demo project.

Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Hide

How to work with friend system in your application

The friend system allows your users to find each other and set up social connections. The SDK supports the following functionality:

  • search by nickname
  • get the list of friends from social networks
  • manage the friend list, send invitations, add and remove friends, block users, etc.
  • manage personal data via the user account

To implement the friend system, you should have the user account functionality in your application. Methods of working with this system use the following parameters from the user account:

  • user ID
  • avatar
  • nickname

Users should specify the nickname to ensure the friend system works correctly. Implement the following nickname specification logics:

  • Use the name that was used for registration via login and password as a nickname.
  • Implement the nickname request during social authentication or platform accounts.

SDK methods

The Login library has the following methods of working with the friend system:

  • XLogin.getCurrentUserFriends — updates the locally cached user friends data.

  • XLogin.updateCurrentUserFriend — updates the status of the user’s social connections. The social connections status is affected by the following actions:
    • send or cancel a friend request
    • accept or decline a friend request
    • delete the user from the friend list
    • block or unblock the user

  • XLogin.getSocialFriends — updates the locally cached data of user’s friends from a social network.

  • XLogin.getUserPublicInfo — gets data from the user’s public profile.

  • XLogin.searchUsersByNickname — searches for the user by nickname.

  • XLogin.startSocialAccountLinking — generates an intent to open a social network authorization window to link an account to a user account.

  • UpdateLinkedSocialNetworks — gets the user’s social networks data.

Implementing a friends system for social networks

To let users interact with friends from social networks in your application, configure the storage of friend data on the Xsolla side:

  1. Go to your Publisher Account.
  2. Click Open in the Login block and go to Login projects.
  3. Click Open and set up in the Login project block.
  4. Go to General settings > Authentication.
  5. Set the Store friends from social networks toggle to On.
  6. Save changes.

To make friends from the social network available to the player in the application, implement the following logic in your application:

  1. Link a social network to a player’s account using the XLogin.createSocialAccountLinkingIntent method.

Example:

Copy
Full screen
Small screen
startActivityForResult(
         XLogin.createSocialAccountLinkingIntent(context, socialNetwork),
         RC_LINKING
 )

  1. Update your friends list using the XLogin.updateSocialFriends method.
  2. Get a list of friends from a linked social network using the XLogin.getSocialFriends method.

Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Hide
Last updated: August 8, 2022

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!