Social login

Social login can be your application’s primary or alternative authentication method.

If the user’s first login is via a social network, a new account is created automatically.

If you use social login as an alternative authentication method, the social network account automatically links to an existing user account if the following conditions are met:

  • A user who signed up with a username/email address and password logged into your application via a social network account.
  • A social network returns an email address.
  • User email address in a social network is the same as the email address used for sign-up in your application.

SDK supports the following providers for social login:

  • Amazon
  • Apple
  • Baidu
  • Battle.net
  • Discord
  • Facebook
  • GitHub
  • Google
  • Kakao
  • LinkedIn
  • MSN
  • Mail.ru
  • Microsoft
  • Naver
  • Odnoklassniki
  • PayPal
  • QQ
  • Reddit
  • Steam
  • Twitch.tv
  • Twitter
  • VK
  • Vimeo
  • WeChat
  • Weibo
  • Xbox Live
  • Yahoo
  • Yandex
  • YouTube

For mobile applications, the SDK also supports social login on the user’s device via a social network client (native authentication via social networks). Currently, SDK supports the following providers for native authentication:

  • Google
  • Facebook
  • WeChat
  • QQ

How-tos

Learn about advanced setups from our how-tos.

How to set up native authentication via social networks

Native authentication lets users log in to your application via a social network account configured on a mobile device.

The first time a user logs in, the social networking application is launched and asks for permission to authenticate the user. After that, authentication is performed automatically without requiring the user to do anything.

Currently, SDK has implemented native authentication via the following social networks:

  • Google
  • Facebook
  • WeChat
  • QQ

To configure native authentication:

  1. Create your Unity project build for Android.
  2. Configure the application in the developer account for the social network:
    1. For authentication via Facebook:
      1. Register and create a new application.
      2. Set up the application page in your Facebook developer account.
    2. For authentication via Google, set up the project in Google API Console.
    3. For authentication via WeChat:
      1. Register and create a new application.
      2. Submit the application for review.
    4. For authentication via QQ:
      1. Register and create a new application.
      2. Submit the application for review.

  1. Set up authentication via social networks on the Xsolla side:
    1. For Facebook and Google, set up social connections in Publisher Account.
    2. For WeChat and QQ, contact your Account Manager.
  2. Set up the asset for your Unity project.

Create Unity project build for Android

  1. Go to your Unity project.
  2. Click File > Build settings in the main menu.
  3. Click Android in the Platform panel.
  4. Click Build.

For further native authentication configuration you will need:

  • Package name found in the Package Name field in the Inspector panel after selecting the Android platform in File > Build settings.
  • Android class name — the class name of the main activity, including the namespace of the application (e.g., com.domain.appname.activity). The class name can be found in AndroidManifest.xml. The main activity’s tag should contain an intent-filter tag with the android.intent.action.MAIN action and the android.intent.category.LAUNCHER category.
  • Android hash key. You can get it with OpenSSL.

Set up application page in your Facebook developer account

  1. Go to project settings in the Facebook developer account.
  2. Go to Settings > Basic.
  3. Click Add Platform and select Android.
  4. Specify package name from your Unity project in the Google Play Package Name field.
  5. Specify Android class name from your Unity project in the Class Name field.
  6. Specify Android hash key from your Unity project in the Key Hashes filed.
  7. Click Save Changes.

For further native authentication configuration, you will need App ID and App Secret found in project settings in Settings > Basic section.

Set up project in Google API Console

  1. Go to Google API Console.
  2. Click New Project.
  3. Specify Project name and Location and click Save.
  4. Go to the created project and click OAuth consent screen in the side menu.
  5. Select External option and click Create.
  6. Specify the necessary parameters and click Save.
  7. Click Credentials in the side menu.
  8. Create an OAuth 2.0 client for your Unity application:

    1. Click Create credentials and select OAuth client ID.
    2. Specify Android in the Application type field.
    3. Specify Name.
    4. Specify package name from your Unity project in the Package name field.
    5. Specify Android hash key from your Unity project in the SHA-1 certificate fingerprint field.
    6. Click Create.
    7. Click OK.

  1. Create an OAuth 2.0 client for the web application:
    1. Click Create credentials and select OAuth client ID.
    2. Specify Web application in the Application type field.
    3. Specify Name.
    4. Click Add URI in the Authorized redirect URIs section and specify https://login.xsolla.com/api/social/oauth2/callback URI.
    5. Click Create.
    6. Click OK.

For further native authentication configuration, you will need Client ID and Client Secret found in settings of the Client ID for the web application.

Set up social connections for Login project in Xsolla Publisher Account

  1. Open your project in Publisher Account.
  2. Click Login in the side menu and go to Login projects > your Login project > Social connections.
  3. To set up authentication via Facebook:

    1. Click Edit in the Facebook panel and change status to Disconnected.
    2. Specify the App ID from the Facebook developer account in the Application ID field.
    3. Specify App Secret from the Facebook developer account in the Application Secret field.
    4. Click Connect.

  1. To set up authentication via Google:
    1. Click Edit in the Google panel and change status to Disconnected.
    2. Specify the Client ID for a web application from the Google API Console in the Application ID field.
    3. Specify the Client Secret for a web application from the Google API Console in the Application Secret field.
    4. Click Connect.

Set up asset for your Unity project

  1. Go to your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu.
  3. Specify the application ID:
    1. Specify App ID from the Facebook developer account in the Facebook App ID field.
    2. Specify Client ID for a web application from the Google API Console in the Google server ID field.
    3. Specify AppID from the WeChat application settings in the WeChat App ID.
    4. Specify AppID from the QQ application settings in the QQ App ID.

    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.
    Hide

Useful links

Last updated: August 1, 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!