Xsolla::UserAccount::XsollaUserAccount
Public Functions
| Name | |
|---|---|
| static void | UpdateUserInfo(UserInfoUpdate info, Action< UserInfo > onSuccess, Action< Error > onError) Updates the specified user’s information. Changes are made on the user data storage side. |
| static void | SearchUsers(string nickname, int offset, int limit, Action< FoundUsers > onSuccess, Action< Error > onError) Searches users by the nickname parameter and gets a list of them. Search can be performed instantly when the user starts entering the search parameter. NOTE: User can search only 1 time per second. |
| static void | GetPublicInfo(string userId, Action< UserPublicInfo > onSuccess, Action< Error > onError) Returns specified user public profile information. |
| static void | GetUserPhoneNumber(Action< UserPhoneNumber > onSuccess, Action< Error > onError) Returns user phone number that is used for two-factor authentication. |
| static void | UpdateUserPhoneNumber(string phoneNumber, Action onSuccess, Action< Error > onError) Changes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server-side). |
| static void | DeleteUserPhoneNumber(string phoneNumber, Action onSuccess, Action< Error > onError) Deletes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server side). |
| static void | UploadUserPicture(byte[] pictureData, string boundary, Action< string > onSuccess, Action< Error > onError) Changes the user’s avatar. Changes are made on the user data storage side (server side). |
| static void | DeleteUserPicture(Action onSuccess, Action< Error > onError) Deletes the user’s avatar. Changes are made on the user data storage side (server side). |
| static void | CheckUserAge(string dateOfBirth, Action< CheckUserAgeResult > onSuccess, Action< Error > onError) Checks user age for a particular region. The age requirements depend on the region. Service determines the user location by the IP address. |
| static void | GetUserEmail(Action< UserEmail > onSuccess, Action< Error > onError) Returns the user’s email. |
| static void | RequestLinkingCode(Action< LinkingCode > onSuccess, Action< Error > onError) Creates the code for linking the platform account to the existing main account when the user logs in to the game via a gaming console. The call is used with Link accounts by code request. |
| static void | LinkConsoleAccount(string userId, string platform, string confirmationCode, Action onSuccess, Action< Error > onError) Links a console account to a unified Xsolla account. Requires server-side implementation. |
| static void | GetUserAttributes(UserAttributeType attributeType, List< string > keys, string userId, Action< UserAttributes > onSuccess, Action< Error > onError) Returns a list of particular user’s attributes with their values and descriptions. Returns only user-editable attributes. |
| static void | UpdateUserAttributes(List< UserAttribute > attributes, Action onSuccess, Action< Error > onError) Updates the values of user attributes with the specified IDs. The method can be used to create or remove attributes. Changes are made on the user data storage side (server side). |
| static void | RemoveUserAttributes(List< string > removingKeys, Action onSuccess, Action< Error > onError) Removes user attributes with the specified IDs. Changes are made on the user data storage side (server side). |
| static void | AddUsernameEmailAuthToAccount(string username, string password, string email, Action< AddUsernameAndEmailResult > onSuccess, Action< Error > onError, string redirectUri =null, int? promoEmailAgreement =null) Adds a username, email address, and password, that can be used for authentication, to the current account. |
| static void | GetUserDevices(Action< UserDevicesInfo > onSuccess, Action< Error > onError) Gets a list of user’s devices. |
| static void | LinkDeviceToAccount(Action onSuccess, Action< Error > onError, DeviceInfo deviceInfo =null) Links the specified device to the current user account. |
| static void | UnlinkDeviceFromAccount(int deviceId, Action onSuccess, Action< Error > onError) Unlinks the specified device from the current user account. |
| static void | GetUserSocialFriends(Action< UserSocialFriends > onSuccess, Action< Error > onError, SocialProvider platform =SocialProvider.None, int offset =0, int limit =500, bool withXlUid =false) Gets a list of user’s friends from a social provider. |
| static void | UpdateUserSocialFriends(Action onSuccess, Action< Error > onError, SocialProvider platform =SocialProvider.None) Begins data processing to update a list of user’s friends from a social provider. Note that there may be a delay in data processing because of the Xsolla Login server or provider server high loads. |
| static void | GetUserFriends(FriendsSearchType type, Action< UserFriends > onSuccess, Action< Error > onError, FriendsSearchSort sortBy =FriendsSearchSort.ByNickname, FriendsSearchOrder sortOrder =FriendsSearchOrder.Asc, int limit =20, int offset =0) Gets a list of users added as friends of the authenticated user. |
| static void | UpdateUserFriends(FriendAction action, string user, Action onSuccess, Action< Error > onError) Modifies relationships with the specified user. |
| static void | LinkSocialProvider(SocialProvider providerName, Action< LinkSocialProviderLink > onSuccess, Action< Error > onError, string redirectUri =null) Links a social network that can be used for authentication to the current account. |
| static void | UnlinkSocialProvider(SocialProvider providerName, Action onSuccess, Action< Error > onError) Unlinks social network that can be used for authentication from the current user account. |
| static void | GetLinkedSocialProviders(Action< LinkedSocialNetworks > onSuccess, Action< Error > onError) Returns the list of social networks linked to the user account. |
Public Functions Documentation
function UpdateUserInfo
- C#
1static void UpdateUserInfo(
2 UserInfoUpdate info,
3 Action< UserInfo > onSuccess,
4 Action< Error > onError
5)
Updates the specified user’s information. Changes are made on the user data storage side.
Parameters:
- info User information.
- onSuccess Called after successful user details modification.
- onError Called after the request resulted with an error.
function SearchUsers
- C#
1static void SearchUsers(
2 string nickname,
3 int offset,
4 int limit,
5 Action< FoundUsers > onSuccess,
6 Action< Error > onError
7)
Searches users by the nickname parameter and gets a list of them. Search can be performed instantly when the user starts entering the search parameter. NOTE: User can search only 1 time per second.
Parameters:
- nickname The search string that may contain: Nickname only, Tag only, Nickname and tag together
- offset Number of the elements from which the list is generated.
- limit Maximum number of users that are returned at a time.
- onSuccess Called after user search is successfully completed.
- onError Called after the request resulted with an error.
function GetPublicInfo
- C#
1static void GetPublicInfo(
2 string userId,
3 Action< UserPublicInfo > onSuccess,
4 Action< Error > onError
5)
Returns specified user public profile information.
Parameters:
- userId User identifier of public profile information to be received.
- onSuccess Called after user profile data was successfully received.
- onError Called after the request resulted with an error.
function GetUserPhoneNumber
- C#
1static void GetUserPhoneNumber(
2 Action< UserPhoneNumber > onSuccess,
3 Action< Error > onError
4)
Returns user phone number that is used for two-factor authentication.
Parameters:
- onSuccess Called after user phone number was successfully received.
- onError Called after the request resulted with an error.
See: UpdateUserPhoneNumber, DeleteUserPhoneNumber
function UpdateUserPhoneNumber
- C#
1static void UpdateUserPhoneNumber(
2 string phoneNumber,
3 Action onSuccess,
4 Action< Error > onError
5)
Changes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server-side).
Parameters:
- phoneNumber Updated user phone number according to national conventions.
- onSuccess Called after user phone number was successfully modified.
- onError Called after the request resulted with an error.
See: GetUserPhoneNumber, DeleteUserPhoneNumber
function DeleteUserPhoneNumber
- C#
1static void DeleteUserPhoneNumber(
2 string phoneNumber,
3 Action onSuccess,
4 Action< Error > onError
5)
Deletes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server side).
Parameters:
- phoneNumber User phone number for removal.
- onSuccess Called after the user phone number was successfully removed.
- onError Called after the request resulted with an error.
See: GetUserPhoneNumber, UpdateUserPhoneNumber
function UploadUserPicture
- C#
1static void UploadUserPicture(
2 byte[] pictureData,
3 string boundary,
4 Action< string > onSuccess,
5 Action< Error > onError
6)
Changes the user’s avatar. Changes are made on the user data storage side (server side).
Parameters:
- pictureData User profile picture in the binary format.
- boundary
- onSuccess Called after the user profile picture was successfully modified.
- onError Called after the request resulted with an error.
See: DeleteUserPicture
function DeleteUserPicture
- C#
1static void DeleteUserPicture(
2 Action onSuccess,
3 Action< Error > onError
4)
Deletes the user’s avatar. Changes are made on the user data storage side (server side).
Parameters:
- onSuccess Called after user profile picture was successfully removed.
- onError Called after the request resulted with an error.
See: UploadUserPicture
function CheckUserAge
- C#
1static void CheckUserAge(
2 string dateOfBirth,
3 Action< CheckUserAgeResult > onSuccess,
4 Action< Error > onError
5)
Checks user age for a particular region. The age requirements depend on the region. Service determines the user location by the IP address.
Parameters:
- dateOfBirth User’s birth date in the
YYYY-MM-DDformat. - onSuccess Called after successful check of the user age.
- onError Called after the request resulted with an error.
function GetUserEmail
- C#
1static void GetUserEmail(
2 Action< UserEmail > onSuccess,
3 Action< Error > onError
4)
Returns the user’s email.
Parameters:
- onSuccess Called after user email was successfully received.
- onError Called after the request resulted with an error.
function RequestLinkingCode
- C#
1static void RequestLinkingCode(
2 Action< LinkingCode > onSuccess,
3 Action< Error > onError
4)
Creates the code for linking the platform account to the existing main account when the user logs in to the game via a gaming console. The call is used with Link accounts by code request.
Parameters:
- onSuccess Called after successful linking code creation.
- onError Called after the request resulted with an error.
See: Xsolla.Auth.XsollaAuth.SignInConsoleAccount, LinkConsoleAccount
function LinkConsoleAccount
- C#
1static void LinkConsoleAccount(
2 string userId,
3 string platform,
4 string confirmationCode,
5 Action onSuccess,
6 Action< Error > onError
7)
Links a console account to a unified Xsolla account. Requires server-side implementation.
Parameters:
- userId Social platform (XBox, PS4, etc) user unique identifier.
- platform Platform name (XBox, PS4, etc).
- confirmationCode Code, taken from unified account.
- onSuccess Success operation callback.
- onError Called after the request resulted with an error.
See: Xsolla.Auth.XsollaAuth.SignInConsoleAccount, RequestLinkingCode
Integration flow on the server side:
- Generate server JWT
- Connect OAuth 2.0 server client Follow the instructions to connect the client and copy the Client ID and Secret key.
- Implement method: Generate JWT with
application/x-www-form-urlencodedpayload parameters:- client_id=YOUR_CLIENT_ID
- client_secret=YOUR_CLIENT_SECRET
- grant_type=client_credentials
- Implement APIs for account linking Link accounts by code with:
- Headers
Content-Type: application/jsonandX-SERVER-AUTHORIZATION: YourGeneratedJwt - Body See documentation.
- Headers
function GetUserAttributes
- C#
1static void GetUserAttributes(
2 UserAttributeType attributeType,
3 List< string > keys,
4 string userId,
5 Action< UserAttributes > onSuccess,
6 Action< Error > onError
7)
Returns a list of particular user’s attributes with their values and descriptions. Returns only user-editable attributes.
Parameters:
- attributeType Type of attributes to get. Can be
ReadonlyorCustom. - keys List of attributes’ keys which you want to get. If not specified, the method returns all user’s attributes.
- userId Identifier of a user whose public attributes should be requested. If not specified, the method returns attributes for the current user.
- onSuccess Called after user attributes were successfully received.
- onError Called after the request resulted with an error.
See: UpdateUserAttributes, RemoveUserAttributes
function UpdateUserAttributes
- C#
1static void UpdateUserAttributes(
2 List< UserAttribute > attributes,
3 Action onSuccess,
4 Action< Error > onError
5)
Updates the values of user attributes with the specified IDs. The method can be used to create or remove attributes. Changes are made on the user data storage side (server side).
Parameters:
- attributes List of attributes of the specified game. To add attribute which does not exist, set this attribute to the
keyparameter. To updatevalueof the attribute, specify itskeyparameter and set the newvalue. You can change several attributes at a time. - onSuccess Called after successful user attributes modification on the server side.
- onError Called after the request resulted with an error.
See: GetUserAttributes, RemoveUserAttributes
function RemoveUserAttributes
- C#
1static void RemoveUserAttributes(
2 List< string > removingKeys,
3 Action onSuccess,
4 Action< Error > onError
5)
Removes user attributes with the specified IDs. Changes are made on the user data storage side (server side).
Parameters:
- removingKeys List of attribute keys for removal.
- onSuccess Called after successful user attributes removal on the server side.
- onError Called after the request resulted with an error.
See: GetUserAttributes, UpdateUserAttributes
function AddUsernameEmailAuthToAccount
- C#
1static void AddUsernameEmailAuthToAccount(
2 string username,
3 string password,
4 string email,
5 Action< AddUsernameAndEmailResult > onSuccess,
6 Action< Error > onError,
7 string redirectUri =null,
8 int? promoEmailAgreement =null
9)
Adds a username, email address, and password, that can be used for authentication, to the current account.
Parameters:
- username Username.
- password User password.
- email User email.
- onSuccess Called after successful email and password linking.
- onError Called after the request resulted with an error.
- redirectUri URI to redirect the user to after account confirmation, successful authentication, two-factor authentication configuration, or password reset confirmation. Must be identical to the OAuth 2.0 redirect URIs specified in Publisher Account. Required if there are several URIs.
- promoEmailAgreement Whether the user gave consent to receive the newsletters.
function GetUserDevices
- C#
1static void GetUserDevices(
2 Action< UserDevicesInfo > onSuccess,
3 Action< Error > onError
4)
Gets a list of user’s devices.
Parameters:
- onSuccess Called after users devices data was successfully received.
- onError Called after the request resulted with an error.
function LinkDeviceToAccount
- C#
1static void LinkDeviceToAccount(
2 Action onSuccess,
3 Action< Error > onError,
4 DeviceInfo deviceInfo =null
5)
Links the specified device to the current user account.
Parameters:
- onSuccess Called after successful linking of the device.
- onError Called after the request resulted with an error.
- deviceInfo Information about the device that is used to identify the user. if not specified, the method defines this infotmation automatically.
function UnlinkDeviceFromAccount
- C#
1static void UnlinkDeviceFromAccount(
2 int deviceId,
3 Action onSuccess,
4 Action< Error > onError
5)
Unlinks the specified device from the current user account.
Parameters:
- deviceId Platform specific unique device ID.
For Android, it is an ANDROID_ID constant.
For iOS, it is an identifierForVendor property.
- onSuccess Called after successful unlinking of the device.
- onError Called after the request resulted with an error.
function GetUserSocialFriends
- C#
1static void GetUserSocialFriends(
2 Action< UserSocialFriends > onSuccess,
3 Action< Error > onError,
4 SocialProvider platform =SocialProvider.None,
5 int offset =0,
6 int limit =500,
7 bool withXlUid =false
8)
Gets a list of user’s friends from a social provider.
Parameters:
- onSuccess Called after user friends data was successfully received.
- onError Called after the request resulted with an error.
- platform Name of a social network. Provider must be connected to Login in Publisher Account.
Can be amazon, apple, baidu, battlenet, discord, facebook, github, google, kakao, linkedin, mailru, microsoft, msn, naver, ok, paypal, psn, qq, reddit, steam, twitch, twitter, vimeo, vk, wechat, weibo, yahoo, yandex, youtube, or xbox.
- offset Number of the elements from which the list is generated.
- limit Maximum number of friends that are returned at a time.
- withXlUid Shows whether the social friends are from your game.
function UpdateUserSocialFriends
- C#
1static void UpdateUserSocialFriends(
2 Action onSuccess,
3 Action< Error > onError,
4 SocialProvider platform =SocialProvider.None
5)
Begins data processing to update a list of user’s friends from a social provider. Note that there may be a delay in data processing because of the Xsolla Login server or provider server high loads.
Parameters:
- onSuccess Called after user friends were successfully received.
- onError Called after the request resulted with an error.
- platform Name of a social network. Provider must be connected to Login in Publisher Account.
Can be amazon, apple, baidu, battlenet, discord, facebook, github, google, kakao, linkedin, mailru, microsoft, msn, naver, ok, paypal, psn, qq, reddit, steam, twitch, twitter, vimeo, vk, wechat, weibo, yahoo, yandex, youtube, or xbox.
If you do not specify it, the call gets friends from all social providers.
function GetUserFriends
- C#
1static void GetUserFriends(
2 FriendsSearchType type,
3 Action< UserFriends > onSuccess,
4 Action< Error > onError,
5 FriendsSearchSort sortBy =FriendsSearchSort.ByNickname,
6 FriendsSearchOrder sortOrder =FriendsSearchOrder.Asc,
7 int limit =20,
8 int offset =0
9)
Gets a list of users added as friends of the authenticated user.
Parameters:
- type Friends type.
- onSuccess Called after user friends data was successfully received.
- onError Called after the request resulted with an error.
- sortBy Condition for sorting the users.
- sortOrder Condition for sorting the list of users.
- offset Parameter that is used for API pagination.
- limit Maximum number of users that are returned at a time. Default: 20.
function UpdateUserFriends
- C#
1static void UpdateUserFriends(
2 FriendAction action,
3 string user,
4 Action onSuccess,
5 Action< Error > onError
6)
Modifies relationships with the specified user.
Parameters:
- action Type of the action.
- user Identifier of the user to change relationship with.
- onSuccess Called after successful user friends data modification.
- onError Called after the request resulted with an error.
function LinkSocialProvider
- C#
1static void LinkSocialProvider(
2 SocialProvider providerName,
3 Action< LinkSocialProviderLink > onSuccess,
4 Action< Error > onError,
5 string redirectUri =null
6)
Links a social network that can be used for authentication to the current account.
Parameters:
- providerName Name of a social network. Provider must be connected to Login in Publisher Account.
Can be amazon, apple, baidu, battlenet, discord, facebook, github, google, instagram, kakao, linkedin, mailru, microsoft, msn, naver, ok, paradox, paypal, psn, qq, reddit, steam, twitch, twitter, vimeo, vk, wechat, weibo, yahoo, yandex, youtube, xbox, playstation.
- onSuccess Called after the URL for social authentication was successfully received.
- onError Called after the request resulted with an error.
- redirectUri URI to redirect the user to after account confirmation, successful authentication, two-factor authentication configuration, or password reset confirmation. Must be identical to the OAuth 2.0 redirect URIs specified in Publisher Account. Required if there are several URIs.
function UnlinkSocialProvider
- C#
1static void UnlinkSocialProvider(
2 SocialProvider providerName,
3 Action onSuccess,
4 Action< Error > onError
5)
Unlinks social network that can be used for authentication from the current user account.
Parameters:
- providerName Name of a social network. Provider must be connected to Login in Publisher Account.
Can be amazon, apple, baidu, battlenet, discord, facebook, github, google, instagram, kakao, linkedin, mailru, microsoft, msn, naver, ok, paradox, paypal, psn, qq, reddit, steam, twitch, twitter, vimeo, vk, wechat, weibo, yahoo, yandex, youtube, xbox, playstation.
- onSuccess Called after the social network successfully unlinked.
- onError Called after the request resulted with an error.
function GetLinkedSocialProviders
- C#
1static void GetLinkedSocialProviders(
2 Action< LinkedSocialNetworks > onSuccess,
3 Action< Error > onError
4)
Returns the list of social networks linked to the user account.
Parameters:
- onSuccess Called after the list of linked social networks was successfully received.
- onError Called after the request resulted with an error.
Found a typo or other text error? Select the text and press Ctrl+Enter.