SDKs for Android / Authentication via device ID
 Back to Docs

SDKs for Android

  • Login library

  • Store library

  • Inventory library

  • Payments library

  • Subscriptions library

  • Authentication

  • Catalog

  • Promotions

  • Item purchase

  • Player inventory

  • User account and attributes

  • Authentication via device ID

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

    Device ID authentication lets users start using the application on a mobile device without entering registration data. The first time a user logs in to the application using the device ID, a new account is created automatically, and the user doesn’t need to enter a username, email address, or other data.

    Notice
    The account created by the device ID allows using the application only on the current mobile device. Access to it is lost after changing an Android device. To save progress in the application and use the account on other devices, the user can upgrade the account by linking a social network or by entering a username, email address, and password.

    With the device ID, you can implement user authentication on one or more mobile devices in the background mode. To use this function, the user should link the device ID to an existing account.

    The device ID is generated by the platform and is available in applications installed on the mobile device. The SDK gets the ID value via the platform API and uses this value to perform various functions with the Xsolla API. The Android device ID is passed in the android.provider.Settings.Secure.ANDROID_ID constant.

    To enable user authentication via device ID for your project:

    1. Open your project in Publisher Account and go to the Login section.
    2. Click Configure in the pane of a Login project.
    3. In the top settings block on the navigation page, click Login API integration.
    4. Set the Login with device ID toggle to On.
    5. Click Save changes.

    The SDK implements methods for the functions listed below.

    Authentication

    SDK method nameDescription
    authenticateViaDeviceId
    Authenticates the user to the application using the current device ID.
    oauthLogout
    Ends the active user session.

    Account upgrade

    SDK method nameDescription
    linkEmailPassword
    Adds a username, email address, and password, that can be used for authentication, to the current account.
    createSocialAccountLinkingIntent
    Links a social network that can be used for authentication to the current account.
    Notice
    The listed methods can be used to upgrade an account created in any available way (e.g. by using a social network or an email address and password).

    Device management

    SDK method nameDescription
    getUsersDevices
    Returns a list of devices linked to the current user account.
    linkDeviceToAccount
    Links the specified device to the current user account.
    unlinkDeviceFromAccount
    Unlinks the specified device from the current user account.
    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.
    Rate this page
    Rate this page
    Is there anything we can improve?

    Don’t want to answer

    Thank you for your feedback!
    Last updated: September 9, 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!