JSON files with widget settings
The widget settings are contained in the following JSON files:
settingsJSON
— main settingssocialsJSON
— social login settingsthemeJSON
— theme settings
You can reuse the settings in the files and display the same widget on different settings. The settings URL is specified in the widget initialization code:
- json
1<script>
2const xl = new XsollaLogin.Widget({
3 // Other settings
4 settingsJSON: "url_string",
5 socialsJSON: "url_string",
6 themeJSON: "url_string"
7});
8</script>
Main settings
The main widget settings are:
- authorization methods (the
authorization_methods
object) - registration fields (the
registration_fields
object) - email address validation (the
email_validation
object) - additional settings
The template of the settingsJSON
file:
- json
1{
2 "authorization_methods": {
3 // Authorization methods
4 },
5 "registration_fields": {
6 // Registration fields
7 },
8 "email_validation": {
9 // Settings for email validation
10 }
11
12 // Other widget settings
13}
Authorization methods
Theauthorization_methods
object contains an array with available authorization methods. The login page is displayed according to the passed settings.Available authorization methods:
email
— authorization by an email address and password. The parameter is passed by default if there is noauthorization_methods
object with a definite list of methods.social
— social login. The parameter is passed by default if there is noauthorization_methods
object with a definite list of methods.username
— authorization by a username and password.phone
— authorization by the phone number and an SMS code.passwordless-email-code
— authorization by an email address and a code sent in an email.
Example:
- json
1{
2 "authorization_methods": {
3 ["email", "phone"]
4 }
5
6 // Other widget settings
7}
Registration fields
Theregistration_fields
object contains an array of fields that are displayed on the registration page of the widget.Parameter | Type | Description |
---|---|---|
User email address. | ||
username | string | User account. |
password | pass | Password. |
password_confirm | pass | Password confirmation. |
given-name | string | User name. |
family-name | string | User family name. |
nickname | string | User nickname. |
bday | date | Birthdate. |
gender | string | Gender. |
country-name | select | Country. |
platform | multi-select | Platform. |
promo_email_agreement | boolean | Consent to receive promo materials. |
Additionally, you can specify the following parameters to a field:
required
(boolean) — whether the field is required.default_value
(array) — an array of default values (for a list of countries or platforms).validation
(object) — validation parameters:allowed_characters
(string) — allowed characters for the field. Separated by a comma in the list as the regular expression values.max_length
(number) — maximum number of characters.min_length
(number) — minimum number of characters.regexps
(array with strings) — a regular expression for validating the entered value.
Example:
- json
1{
2 // Other widget settings
3
4 "registration_fields": [
5 {
6 "name": "username",
7 "required": false,
8 "type": "str",
9 "validation": {
10 "allowed_characters": "A-Z, a-z, 0-9",
11 "max_length": 16,
12 "min_length": 5,
13 "regexps": ["^.{5,16}$"]
14 }
15 },
16 { "name": "email", "required": true, "type": "email", "validation": {} },
17 { "name": "bday", "required": true, "type": "date", "validation": {} },
18 {
19 "name": "platform",
20 "default_value": ["MacOS", "Nintendo Switch", "Steam"],
21 "required": false,
22 "type": "multi-select",
23 "validation": {}
24 },
25 {
26 "name": "country-name",
27 "default_value": ["US", "GB", "DE"],
28 "required": false,
29 "type": "select",
30 "validation": {}
31 },
32 { "name": "password", "required": true, "type": "pass", "validation": {} },
33 {
34 "name": "password_confirm",
35 "required": false,
36 "type": "pass",
37 "validation": {}
38 },
39 {
40 "name": "promo_email_agreement",
41 "required": false,
42 "type": "bool",
43 "validation": {}
44 }
45 ]
46}
Email address validation
Theemail_validation
object contains the se_xsolla_email_validator
parameter that validates data entered in the email
field.Parameter | Type | Description |
---|---|---|
use_xsolla_email_validator | boolean | Whether to use the additional validation of data entered in the email field. If true , an email address is validated on the front-end and back-end sides with features like SMTP, RFC, and Greylist. If false , the email address is validated on the front-end side only. false by default. |
- json
1{
2 // Other widget settings
3
4 "email_validation": {
5 "use_xsolla_email_validator": true
6 }
7}
Additional settings
Additional settings are passed in the JSON object root of thesettingsJSON
file.Parameter | Type | Description |
---|---|---|
can_register | boolean | Whether to enable registration for users. true by default. |
can_reset_password | boolean | Whether to enable password reset for users. true by default. |
consent_url | string | Link to the user policy consent. |
cookie_policy | string | Link to the cookie policy. |
privacy_policy | string | Link to the privacy policy. |
tos_url | string | Link to the terms of use. |
game_name | string | Name of a project or game. Displayed in some authorization methods. |
- json
1{{
2 // Other widget settings
3
4 "can_register": true,
5 "can_reset_password": true,
6 "cookie_policy": "https://someurl.com"
7}
Social networks settings
For social login, the following parameters are passed in the socialsJSON
file:
- list of regions
- parameters and types of social networks for every region
The template of the socialsJSON
file:
- json
1{
2 "1": {
3 "primary": [
4 // Array of social networks for primary type
5 ],
6 "secondary": [
7 // Array of social networks for secondary type
8 ]
9 },
10 "2": {
11 "primary": [
12 // Array of social networks for primary type
13 ],
14 "secondary": [
15 // Array of social networks for secondary type
16 ]
17 },
18 "3": {
19 "primary": [
20 // Array of social networks for primary type
21 ],
22 "secondary": [
23 // Array of social networks for secondary type
24 ]
25 },
26 "4": {
27 "primary": [
28 // Array of social networks for primary type
29 ],
30 "secondary": [
31 // Array of social networks for secondary type
32 ]
33 },
34 "5": {
35 "primary": [
36 // Array of social networks for primary type
37 ],
38 "secondary": [
39 // Array of social networks for secondary type
40 ]
41 },
42 "6": {
43 "primary": [
44 // Array of social networks for primary type
45 ],
46 "secondary": [
47 // Array of social networks for secondary type
48 ]
49 }
50}
Every region has a number:
- 1 — Europe
- 2 — China
- 3 — North and South Korea
- 4 — CIS
- 5 — North and South America
- 6 — the rest of the world
The type of a social network is defined for every region. There are 2 types of social networks: primary (primary
) and secondary (secondary
). The primary social networks are displayed as a big button and are more visible on the widget page. The secondary social networks are displayed as small buttons and are less visible.

Every type of a social network contains an array of objects:
Parameter | Type | Description |
---|---|---|
name | string | Name of a social network. Available options: amazon , apple , baidu , battlenet , china_telecom , discord , email , epicgames , facebook , github , google , google-plus , instagram , kakao , linkedin , mailru , microsoft , msn , naver , ok , paradox , paypal , pinterest , qq , reddit , steam , slack , twitch , twitter , vimeo , vk , wechat , weibo , xbox , yahoo , yandex , youtube . |
jwt | string | Link for opening a social network if the JWT authorization is used. |
oauth2 | string | Link for opening a social network if the OAuth 2.0 protocol-based authorization is used. |
- json
1{
2 "1": {
3 "primary": [{
4 "name": "google",
5 "jwt": "https://login.xsolla.com/api/social/google/login_redirect",
6 "oauth2": "https://login.xsolla.com/api/oauth2/social/google/login_redirect"
7 }],
8 "secondary": [{
9 "name": "facebook",
10 "jwt": "https://login.xsolla.com/api/social/facebook/login_redirect",
11 "oauth2": "https://login.xsolla.com/api/oauth2/social/facebook/login_redirect"
12 },
13 {
14 "name": "twitter",
15 "jwt": "https://login.xsolla.com/api/social/twitter/login_redirect",
16 "oauth2": "https://login.xsolla.com/api/oauth2/social/twitter/login_redirect"
17 }
18 ]
19 },
20 "2": {
21 "primary": [{
22 "name": "wechat",
23 "jwt": "https://login.xsolla.com/api/social/wechat/login_redirect",
24 "oauth2": "https://login.xsolla.com/api/oauth2/social/wechat/login_redirect"
25 }],
26 "secondary": [{
27 "name": "facebook",
28 "jwt": "https://login.xsolla.com/api/social/facebook/login_redirect",
29 "oauth2": "https://login.xsolla.com/api/oauth2/social/facebook/login_redirect"
30 },
31 {
32 "name": "twitter",
33 "jwt": "https://login.xsolla.com/api/social/twitter/login_redirect",
34 "oauth2": "https://login.xsolla.com/api/oauth2/social/twitter/login_redirect"
35 },
36 {
37 "name": "steam",
38 "jwt": "https://login.xsolla.com/api/social/steam/login_redirect",
39 "oauth2": "https://login.xsolla.com/api/oauth2/social/steam/login_redirect"
40 }
41 ]
42 }
43
44 // More regions
45}
Theme settings
The widget theme settings include:
- widget color and size settings
- rounding settings (the
rounding
object) - widget background settings (the
background
object) - header settings (the
header
object) - widget tabs settings (the
tabs
object) - social networks display settings (the
primary_socials
andsecondary_socials
objects) - scene settings (the
scene
object)
The template of the themeJSON
file:
- json
1{
2 // Color and size settings
3
4 "header": {
5 // Header settings
6 },
7 "background": {
8 // Widget background settings
9 },
10 "rounding": {
11 // Rounding settings
12 },
13 "tabs": {
14 // Tab settings
15 },
16 "primary_socials": {
17 // Display settings for the primary social networks
18 },
19 "secondary_socials": {
20 // Display settings for the secondary social networks
21 },
22 "scene": {
23 // Scene settings
24 }
25}
Widget color and size
The color and size of the widget are passed in the JSON object root of thethemeJSON
file.Parameter | Type | Description |
---|---|---|
primary_color | string | Primary widget color (color of buttons and active input fields borders) in the RGB or HEX format. Default value is #0073F7 . |
secondary_color | string | Secondary widget color (color of inactive input fields) in the RGB or HEX format. Default value is #DADADA . |
error_color | string | Error texts color in the RGB or HEX format. Default value is #EB002F . |
text_color | string | Main text color in the RGB or HEX format. Default value is #000000 . |
Example:
- json
1{
2 // Other theme settings
3
4 "primary_color": "#708090",
5 "secondary_color": "#4682B4"
6}
Rounding
The rounding
object contains parameters of rounding for different widget elements. The property applies to all four corners simultaneously.
Parameter | Type | Description |
---|---|---|
inputs | string | Rounding in pixels for active fields. Default value is 6px . |
buttons | string | Rounding in pixels for buttons. Default value is 100px . |
widget | string | Rounding in pixels for the widget. Default value is 6px . |
- json
1{
2 // Other theme settings
3
4 "rounding": {
5 "inputs": "8px",
6 "widget": "8px"
7
8 }
9}
Background
Thebackground
object contains the widget background parameters.Parameter | Type | Description |
---|---|---|
color | string | Background color in the RGB or HEX format. Default value is #FFFFFF . |
image | object | Background image. The object contains a link to the image and opacity settings. The default opacity value is 1 . |
- json
1{
2 // Other theme settings
3
4 "background": {
5 "color": "#708090",
6 "image": {
7 "url": "https://someurl.com",
8 "opacity": "3"
9 }
10 }
11}
Header
Theheader
object contains the parameters of the widget header — an area above all widget fields.Parameter | Type | Description |
---|---|---|
image | object | Header background image. The object contains a link to the image, opacity settings, and the background image size. The default opacity value is 1 .Available values of the background image size correspond with the values of the background-size CSS property (cover by default). |
- json
1{
2 // Other theme settings
3
4 "header": {
5 "image": {
6 "url": "https://someurl.com",
7 "opacity": "3",
8 "size": "cover"
9 }
10 }
11}
Tabs
Thetabs
object contains a hide
parameter. This parameter manages the display of registration or authorization tabs on the widget.Parameter | Type | Description |
---|---|---|
hide | boolean | Whether to hide the authorization or registration tabs on a widget. Use the true value to, for example, temporarily hide the registration tab or display registration and authorization pages separately. Default value is false . |
- json
1{
2 // Other theme settings
3
4 "tabs": {
5 "hide": true
6 }
7}
Social networks display
Theprimary_socials
and secondary_socials
objects contain the hide
parameter that manages the display of primary and secondary social networks on a widget.Parameter | Type | Description |
---|---|---|
hide | boolean | Whether to hide social networks. Default value is false . |
- json
1{
2 // Other theme settings
3
4 "primary_socials": {
5 "hide": true
6 },
7 "secondary_socials": {
8 "hide": false
9 }
10}
Scene
Thescene
object contains parameters for a scene — an area around the widget.Parameter | Type | Description |
---|---|---|
color | string | Background color in the RGB or HEX format. Default value is #FFFFFF . |
image | object | Background image. The object contains a link to the image, opacity settings, and the background image size. Available values of the background image size correspond with the values of the background-size CSS property (cover by default). |
- json
1{
2 // Other theme settings
3
4 "scene": {
5 "color": "#708090",
6 "image": {
7 "url": "https://someurl.com",
8 "size": "cover"
9 }
10 }
11}
Found a typo or other text error? Select the text and press Ctrl+Enter.