Set up Login Android SDK

To integrate the Login Android SDK:

  1. Set up Xsolla Login in your Publisher Account.
  2. Install and initialize the library.
  3. Set up event processing and SDK methods.

Set up Login in Publisher Account

  1. Go to your project and click Connect in the Login block. You can go to the Login settings from any section of Publisher Account by clicking the Login button in the left-hand-side menu.

  1. Go to Login projects and click Set up Login.

  1. Specify a Login name and click Create.

  1. Go to General settings > URL block and specify the Callback URL that the user is redirected to after the email confirmation or password reset.
  2. Select the Xsolla storage in the User data storage block.

Install the library

The library is available in JCenter.

To install the library:

  1. Start Android Studio.
  2. Open build.gradle file of your application.
  3. Add the following line to the dependencies section, where <version_number> is the required version of the Login Android SDK:

Copy
Full screen
Small screen
implementation 'com.xsolla.android:login:<version_number>'

Initialize the library

To initialize the library:

  • If you did not specify the Callback URL in your Publisher Account, add the following line to your Android project source code:

Copy
Full screen
Small screen
val loginConfig = LoginConfig.JwtBuilder()
                .setProjectId("login-project-id")
                .build()

XLogin.init(applicationContext, loginConfig)

// OR

val loginConfig = LoginConfig.OauthBuilder()
                .setProjectId("login-project-id")
                .setOauthClientId("oauth2-client-id")
                .build()

XLogin.init(applicationContext, loginConfig)

Note:
The default Callback URL is https://login.xsolla.com/api/blank.

  • if you specified Callback URL in your Publisher Account, add the following lines to your Android project source code:

Copy
Full screen
Small screen
val loginConfig = LoginConfig.JwtBuilder()
                .setProjectId("login-project-id")
                .setCallbackUrl("your-callback-url")
                .build()

XLogin.init(applicationContext, loginConfig)

// OR

val loginConfig = LoginConfig.OauthBuilder()
                .setProjectId("login-project-id")
                .setOauthClientId("oauth2-client-id")
                .setCallbackUrl("your-callback-url")
                .build()

XLogin.init(applicationContext, loginConfig)