Companion

object Companion

Functions

Link copied to clipboard
fun authenticateViaDeviceId(callback: AuthViaDeviceIdCallback)

Authenticates the user via a particular device ID.

Link copied to clipboard
fun canRefreshToken(): Boolean
Link copied to clipboard
fun checkUserAge(birthday: String, callback: CheckUserAgeCallback)

Checks user’s age for a particular region. The age requirements depend on the region. Service determines the user’s location by the IP address.

Link copied to clipboard
fun completeAuthByEmail(    email: String,     code: String,     operationId: String,     callback: CompletePasswordlessAuthCallback)

Completes authentication after the user enters a one-time code or follows a link received in an email.

Link copied to clipboard
fun completeAuthByMobilePhone(    phoneNumber: String,     code: String,     operationId: String,     callback: CompletePasswordlessAuthCallback)

Completes authentication after the user enters a one-time code or follows a link received by SMS.

Link copied to clipboard

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.

Link copied to clipboard
fun deleteCurrentUserAvatar(callback: DeleteCurrentUserAvatarCallback)

Deletes the user’s avatar. Changes are made on the user data storage side (server side).

Link copied to clipboard
fun deleteCurrentUserPhone(phone: String, callback: DeleteCurrentUserPhoneCallback)

Deletes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server side).

Link copied to clipboard
fun finishAuthWithXsollaWidget(    activity: Activity?,     activityResultRequestCode: Int,     activityResultCode: Int,     activityResultData: Intent?,     callback: FinishXsollaWidgetAuthCallback?)

Finishes authentication via xsolla widget

Link copied to clipboard
fun finishSocialAuth(    activity: Activity?,     socialNetwork: SocialNetwork?,     activityResultRequestCode: Int,     activityResultCode: Int,     activityResultData: Intent?,     callback: FinishSocialCallback?)

Finishes authentication via a social network

Link copied to clipboard
fun finishSocialLinking(    activityResultRequestCode: Int,     activityResultCode: Int,     activityResultData: Intent?,     callback: FinishSocialLinkingCallback?)

Finishes linking the social network to current user account.

Link copied to clipboard
fun getCurrentUserDetails(callback: GetCurrentUserDetailsCallback)

Returns user details.

Link copied to clipboard
fun getCurrentUserEmail(callback: GetCurrentUserEmailCallback)

Returns the email of the authenticated user.

Link copied to clipboard
fun getCurrentUserFriends(    afterUrl: String?,     type: UserFriendsRequestType,     sortBy: UserFriendsRequestSortBy,     sortOrder: UserFriendsRequestSortOrder,     callback: GetCurrentUserFriendsCallback,     @IntRange(from = 1, to = 50) limit: Int = 20)

Returns user friends data.

Link copied to clipboard
fun getCurrentUserPhone(callback: GetCurrentUserPhoneCallback)

Returns user phone number that is used for two-factor authentication.

Link copied to clipboard
fun getLinkedSocialNetworks(callback: LinkedSocialNetworksCallback)

Returns the list of linked social networks.

Link copied to clipboard
fun getLinksForSocialAuth(locale: String, callback: GetLinksForSocialAuthCallback)

Returns list of links for social authentication enabled in Publisher Account. The links are valid for 10 minutes. You can get the link by this method and add it to your button for authentication via the social network.

Link copied to clipboard
fun getOtcCode(    login: String,     operationId: String,     callback: GetOtcCodeCallback)

Waits until the user follows the link provided via email/SMS and returns the code.

Link copied to clipboard
fun getSocialFriends(    platform: FriendsPlatform?,     fromGameOnly: Boolean,     callback: GetSocialFriendsCallback,     offset: Int = 0,     @IntRange(from = 1, to = 500) limit: Int = 500)

Returns user friends data from a social provider.

Link copied to clipboard
fun getUserPublicInfo(userId: String, callback: GetUserPublicInfoCallback)

Returns specified user public profile information.

Link copied to clipboard
fun getUsersAttributesFromClient(    keys: List<String>?,     publisherProjectId: Int?,     userId: String?,     getReadOnlyAttributes: Boolean,     callback: GetUsersAttributesCallback)

Returns a list of particular user’s attributes with their values and descriptions. Returns only user-editable attributes.

Link copied to clipboard
fun getUsersDevices(callback: GetUsersDevicesCallback)

Returns a list of devices linked to the current user account.

Link copied to clipboard
fun getXsollaWidgetUrl(locale: String?): String
Link copied to clipboard
fun init(context: Context, loginConfig: LoginConfig)

Initialize SDK

Link copied to clipboard
fun isTokenExpired(): Boolean
Link copied to clipboard
fun linkDeviceToAccount(callback: LinkDeviceToAccountCallback)

Links the specified device to the current user account.

Link copied to clipboard
fun linkEmailPassword(    email: String,     password: String,     username: String,     promoEmailAgreement: Boolean,     callback: LinkEmailPasswordCallback)

Adds a username, email address, and password, that can be used for authentication, to the current account.

Link copied to clipboard
fun login(    username: String,     password: String,     callback: AuthCallback)

Authenticates the user by the username/email and password specified via the authentication interface.

Link copied to clipboard
fun logout()

Clear authentication data

Link copied to clipboard
fun oauthLogout(sessions: String, callback: OauthLogoutCallback)

Logs the user out and deletes the user session according to the value of the sessions parameter.

Link copied to clipboard
fun refreshToken(callback: RefreshTokenCallback)

Refreshes OAuth 2.0 access token

Link copied to clipboard
fun register(    username: String,     email: String,     password: String,     callback: RegisterCallback,     acceptConsent: Boolean? = null,     promoEmailAgreement: Int? = null,     locale: String? = null)

Creates a new user account in the application and sends a sign-up confirmation email to the specified email address. To complete registration, the user must follow the link from the email.

Link copied to clipboard
fun resendAccountConfirmationEmail(    username: String,     callback: ResendAccountConfirmationEmailCallback,     locale: String? = null)

Resends an account confirmation email to a user. To complete account confirmation, the user should follow the link in the email.

Link copied to clipboard
fun resetPassword(    username: String,     callback: ResetPasswordCallback,     locale: String? = null)

Resets the user’s current password and sends an email to change the password to the email address specified during sign-up.

Link copied to clipboard
fun searchUsersByNickname(    nickname: String?,     callback: SearchUsersByNicknameCallback,     offset: Int = 0,     @IntRange(from = 1, to = 100) limit: Int = 100)

Searches users by nickname and gets a list of them. Search is performed by substring if it is in the beginning of the string. The current user can call this method only one time per second.

Link copied to clipboard
fun setTokenData(    token: String,     refreshToken: String,     expiresIn: Long)

set authentication data

Link copied to clipboard
fun startAuthByEmail(    email: String,     callback: StartPasswordlessAuthCallback,     sendLink: Boolean = false,     linkUrl: String? = null)

Starts user authentication and sends an email with a one-time code and a link to the specified email address (if login via magic link is configured for the Login project).

Link copied to clipboard
fun startAuthByMobilePhone(    phoneNumber: String,     callback: StartPasswordlessAuthCallback,     sendLink: Boolean = false,     linkUrl: String? = null)

Starts user authentication and sends an SMS with a one-time code and a link to the specified phone number (if login via magic link is configured for the Login project).

Link copied to clipboard
fun startAuthWithXsollaWidget(    activity: Activity?,     callback: StartXsollaWidgetAuthCallback?,     locale: String? = null)
fun startAuthWithXsollaWidget(    fragment: Fragment?,     callback: StartXsollaWidgetAuthCallback?,     locale: String? = null)

Starts authentication via xsolla widget

Link copied to clipboard
fun startSocialAuth(    activity: Activity?,     socialNetwork: SocialNetwork?,     callback: StartSocialCallback?)
fun startSocialAuth(    fragment: Fragment?,     socialNetwork: SocialNetwork?,     callback: StartSocialCallback?)

Starts authentication via a social network

Link copied to clipboard
fun startSocialLinking(    socialNetwork: SocialNetwork,     activity: Activity? = null,     callback: StartSocialLinkingCallback?)
fun startSocialLinking(    socialNetwork: SocialNetwork,     fragment: Fragment? = null,     callback: StartSocialLinkingCallback?)

Links a social network that can be used for authentication to the current account.

Link copied to clipboard
fun unlinkDeviceFromAccount(id: Int, callback: UnlinkDeviceFromAccountCallback)

Unlinks the specified device from the current user account.

Link copied to clipboard
fun unlinkSocialNetwork(socialNetwork: SocialNetwork, callback: UnlinkSocialNetworkCallback)

Unlinks social network from current user account.

Link copied to clipboard
fun updateCurrentUserDetails(    firstName: String?,     gender: String?,     lastName: String?,     nickname: String?,     callback: UpdateCurrentUserDetailsCallback)

Updates the specified user’s information. Changes are made on the user data storage side.

Link copied to clipboard
fun updateCurrentUserFriend(    friendXsollaUserId: String,     action: UpdateUserFriendsRequestAction,     callback: UpdateCurrentUserFriendsCallback)

Modifies relationships with the specified user.

Link copied to clipboard
fun updateCurrentUserPhone(phone: String?, callback: UpdateCurrentUserPhoneCallback)

Changes the user’s phone number that is used for two-factor authentication. Changes are made on the user data storage side (server-side).

Link copied to clipboard
fun updateSocialFriends(platform: FriendsPlatform?, callback: UpdateSocialFriendsCallback)

Begins processing to update a list of user’s friends from a social provider. Please note that there may be a delay in data processing because of the Xsolla Login server or provider server high loads.

Link copied to clipboard
fun updateUsersAttributesFromClient(    attributes: List<UserAttribute>?,     publisherProjectId: Int?,     removingKeys: List<String>?,     callback: UpdateUsersAttributesCallback)

Updates the values of user attributes with the specified IDs. The method can be used to create and remove attributes. Changes are made on the user data storage side (server side).

Link copied to clipboard
fun uploadCurrentUserAvatar(file: File, callback: UploadCurrentUserAvatarCallback)

Changes the user’s avatar. Changes are made on the user data storage side (server side).

Properties

Link copied to clipboard
val refreshToken: String?

Get refresh token

Link copied to clipboard
val token: String?

Get authentication token

Link copied to clipboard
val tokenExpireTime: Long?

Get token expire time

Sources

Link copied to clipboard