Gerenciamento de usuários
You can use attributes to manage additional information about the users of your application. The user attribute is a key-value pair. The SDK 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:
GetUserAttributes
— gets a list of user attributes. TheGet user’s attributes from client API call is used alongside the SDK method.UpdateUserAttributes
— updates the values of user attributes. TheUpdate user’s attributes from client API call is used alongside the SDK method.RemoveUserAttributes
— removes user attributes with the specified IDs, changes are made on the server side. TheUpdate user’s attributes from client API call is used alongside the SDK method.
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:
- Enter your Publisher Account.
- Go to the cookie files viewpage via the developers’ tools in your browser.
- Copy the value from the
pa-v4-token
parameter and paste it to theAuthorization
header.
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
You can manage the user account via the API calls. The Login & Account System asset has the following methods implemented:
GetUserInfo
— updates locally cached user data.
UpdateUserInfo
— changes the specified user’s data.GetUserPhoneNumber
— updates the locally cached user phone number.ChangeUserPhoneNumber
— changes the user’s phone number.DeleteUserPhoneNumber
— deletes the user’s phone number.UploadUserPicture
— changes the user’s avatar.DeleteProfilePicture
— deletes the user’s avatar.
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.
Métodos SDK
The Login & Account System asset has the following methods of working with the friend system:
GetUserFriends
— updates the locally cached user friends data. TheGet user’s friends API call is used alongside the SDK method.
UpdateUserFriends
— updates the status of the user’s social connections. TheUpdate user’s friends API call is used alongside the SDK method. 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
GetUserSocialFriends
— updates the locally cached data of user’s friends from a social network. TheGet social account friends API call is used alongside the SDK method.
GetPublicInfo
— gets data from the user’s public profile. TheGet user public profile API call is used alongside the SDK method.
SearchUsers
— searches for the user by nickname. TheSearch users by nickname API call is used alongside the SDK method.
LinkSocialProvider
— links the user account and a social network that the player uses for authentication. TheLink social network to user’s account API call is used alongside the SDK method.
GetLinkedSocialProviders
— updates the user’s social networks data. TheGet linked networks API call is used alongside the SDK method.
GetSocialNetworkAuthUrl
— gets the URL to link the social network to the player’s account. TheGet URL to link social network to account API call is used alongside the SDK method.
Implementando um sistema de amigos para redes sociais
To let users interact with friends from social networks in your application, configure the storage of friend data on the Xsolla side:
- Go to your Publisher Account.
- Click Open in the Login block and go to Login projects.
- Click Open and set up in the Login project block.
- Go to General settings > Authentication.
- Set the Store friends from social networks toggle to On.
- Save changes.
To make friends from the social network available to the player in the application, implement the following logic in your application:
- Link a social network to a player’s account using the
GetSocialNetworkAuthUrl
method. TheGet URL to link social network to account API call is used alongside the SDK method. - Update your friends list using the
UpdateUserSocialFriends
method. TheUpdate social account friends API call is used alongside the SDK method. - Get a list of friends from a linked social network using the
GetUserSocialFriends
method. TheGet social account friends API call is used alongside the SDK method.
Encontrou um erro de texto ou digitação? Selecione o texto e pressione Ctrl+Enter.