SDK for Unity (PC, web) / Social login
  Back to Docs

SDK for Unity (PC, web)

Social login

Notice
The SDK doesn’t support authentication via social networks in WebGL builds.

In your application, you can implement user authentication using their account in social networks. If the user’s first login is via a social network, a new account is created automatically. The user doesn’t need to enter a username, email address, or other data.

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

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.
  • The user’s email address in a social network matches the email address used to sign up in your application.

You can also implement manual linking of a social network account.

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

To set up authentication through web services:

  1. In the application interface, add buttons for authentication via social networks.
  2. Set up social connections for a Login project in Publisher Account.
  3. Implement authentication logic on the application side.

Set up social connections for Login project in Xsolla Publisher Account

Notice
In Publisher Account, ensure the Classic login and Social login option are selected for the Login project that you use in your application. You can change the login method later by clicking the Change Login method link. Previously saved settings will not be lost.
  1. Open your project in Publisher Account.
  2. In the side menu, click Login.
  3. Click Configure in the pane of a Login project.
  4. Go to the Authentication block and select the Social login section.

  1. Connect social networks that users can use to sign up and log into the application:

    • To connect a social network, click the ⚙ icon and select Connect.
    • To connect several social networks at once, select the required panes (their borders will turn green). Then, from the Manage drop-down menu, select Connect.
    • To connect all available social networks, click Select all. Then, from the Manage drop-down menu, select Connect.
Note
Xsolla’s Application ID and secret key are used for authentication by default. If your application is set up using a developer account of the social provider, you can specify your own Application ID and secret key. Detailed instructions for locating the Application ID and secret are available in the social network card settings in Publisher Account.

Integrate on application side

To implement the social login logic, call the AuthViaSocialNetwork SDK method and pass the following parameters to the method:

  • SocialProvider — the name of the social network
  • onSuccess — successful user authentication callback
  • onCancelled — user cancels authentication callback
  • onError — error callback
Note
An example of the implementation of this logic is available in the Assets/Xsolla.Demo/Login/Scripts/Login/Auth/SocialAuth.cs script of the demo project.
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.

Useful links

Last updated: December 20, 2024

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!