Xsolla Login widget

Xsolla Login widget allows you to integrate a ready-made interface for user authentication into your project and reduce the cost of development for code and UI.

Restrictions:

  • The widget is only supported on builds for mobile platforms.
  • The widget only supports the following user authentication methods:
    • сlassic login via username/email and password
    • passwordless login via a one-time code or link sent via SMS or email
    • web-based authentication via social networks

Set up redirecting users to the application after successful authentication using the widget:

  1. Open your project in Publisher Account.
  2. In the side menu, click Login.
  3. Select the Login project and click Configure.
  4. Select the Callback URLs section.
  5. In the Callback URL field, specify the same user redirect paths that you specified earlier when configuring the OAuth 2.0 client.
  6. Click Save changes.

To add authentication in mobile application using widget:

  1. Connect native Xsolla SDK for Android or iOS to your project.
  2. Start authorization and processing of its results:

    1. Implement a UI for user authentication in your application (for example, a Login button).
    2. In accordance with the logic of the application, implement a call of the authWithXsollaWidget native method.

Example of starting authentication using the widget:

Copy
Full screen
Small screen
NativeUtil.authWithXsollaWidget();
    1. On the Cocos Creator side, subscribe to the successful authentication event. This event is generated at the scene level by the native Activity that handles the authorization result. Once aythentication is successful, call thehandler method that takes an object with the user’s token. This object can be used to continue working with the Xsolla API.
Note
From native scripts, the callback methods in Cocos Creator should be called from the game thread.

    1. Subscribe to authentication error and authentication cancellation events with a call to the corresponding handler methods.

Subscription example:

Copy
Full screen
Small screen
director.getScene().on(Events.XSOLLA_WIDGET_AUTH_SUCCESS, this.handleSuccessfulXsollaWidgetAuth, this );
director.getScene().on(Events.XSOLLA_WIDGET_AUTH_ERROR, this.handleErrorXsollaWidgetAuth, this );
director.getScene().on(Events.XSOLLA_WIDGET_AUTH_CANCELED, this.handleCancelXsollaWidgetAuth, this );

Xsolla provides standard widget templates. Their appearance and content is determined by the Login method chosen for your project and widget customization settings from Publisher Account.

Notice
Widget customization is available only after you sign the Xsolla Product Licensing Agreement. To sign the agreement, go to the Agreements & Taxes > Agreements section in your Publisher Account.
Standard view of the classic login widget:

Demo project widget view for several Login methods:

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!

Useful links

Last updated: January 22, 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!