# Collecting email addresses and phone numbers ## How it works The Login product automatically saves the contact information of users provided to your Login project when they register or log into your application. This information is stored in the Xsolla database and includes the user’s email address and phone number. In some cases, not all contact details may be passed, for example: - With the passwordless login option, only the contact details that were specified by the user to receive a one-time confirmation code are passed to your Login project, that is, only an email address or phone number. - When authorizing through a social network, its provider may not pass information about users’ email addresses. You can additionally request missing contact details using the [Login](/authenticate-users) product and use them to: - export users’ emails to your Mailchimp account and add them to your newsletter list; - create a unique identifier for the user based on their email address or phone number. > [!NOTE] > If you have integrated [Xsolla Launcher](/distribute-game/launcher), emails are collected automatically without any additional settings. ```mermaid %%{init: {'themeVariables': { 'noteBkgColor': 'transparent', 'noteBorderColor': 'transparent', 'labelBoxBkgColor': 'transparent', 'labelBoxBorderColor': '#8ADCEC', 'altSectionBkgColor': 'transparent' }}}%% sequenceDiagram participant U as User participant YC as Your client participant XL as Xsolla Login server participant SN as Social network server U->>YC: Clicks social network icon YC->>XL: Sends request to authenticate via social network activate XL XL-->>U: Redirects user to social network login page deactivate XL activate U U->>SN: Enters social network credentials deactivate U activate SN note right of SN: Authorizes user deactivate SN SN->>XL: Passes user parameters activate XL note right of XL: Processes obtained data deactivate XL opt User email is not in database XL-->>U: Displays email entry form activate U U->>XL: Enters email deactivate U XL-->>U: Sends confirmation email activate U U->>XL: Confirms email deactivate U activate XL note right of XL: Saves user email to database deactivate XL end ``` ## Who can use it Partners who have already integrated [Login](/authenticate-users), as well as configured the option to log into the application through social networks or use passwordless authorization. ## How to get it Depending on the [integration option](/authenticate-users/login/integration-guide/integrate-solution/) selected for your Login project, you can configure the collection of email addresses and phone numbers: - [via the Login widget v2.0](#login_features_collecting_emails_via_widget) - [via the Login API calls](#login_features_collecting_emails_via_api) ### Collecting email addresses and phone numbers via Login widget v2.0 With Login widget v2.0, you can prompt users for their email addresses and/or phone numbers if this information was not provided: - when registering through social networks; - when entering the application with a one-time code (i.e., when using the passwordless authentication). **Audience: all other audiences** After you enable the request for email addresses and/or phone numbers in Publisher Account, your Login project will automatically: a. display forms to the user for entering their email address and/or phone number; b. after filling in the forms, send the user a code or a link to confirm the entered information; c. check the confirmation code and store the received information in the database. You can make it mandatory for users to complete the forms. To enable the collection of email addresses and phone numbers of users: 1. Open your project in [Publisher Account](https://publisher.xsolla.com/) and go to the **Players > Login** section. 2. Click **Configure** in the pane of a Login project. 3. Go to the **Authentication** block and select the **Miscellaneous data form** section. **End of audience: all other audiences** **Audience: Mobile games** After you enable the request for email addresses and/or phone numbers in the account for mobile games, your Login project will automatically: a. display forms to the user for entering their email address and/or phone number; b. after filling in the forms, send the user a code or a link to confirm the entered information; c. check the confirmation code and store the received information in the database. You can make it mandatory for users to complete the forms. To enable the collection of email addresses and phone numbers of users: 1. Open your project in [the account for mobile games](https://xsolla.com/for/mobile-games/account/) and go to the **Other tools > Login** section. 2. Click **Configure** in the pane of a Login project. 3. Go to the **Authentication** block and select the **Miscellaneous data form** section. **End of audience: Mobile games** **Audience: Free-to-play PC games** After you enable the request for email addresses and/or phone numbers in the account, your Login project will automatically: a. display forms to the user for entering their email address and/or phone number; b. after filling in the forms, send the user a code or a link to confirm the entered information; c. check the confirmation code and store the received information in the database. You can make it mandatory for users to complete the forms. To enable the collection of email addresses and phone numbers of users: 1. In your project in the [account](https://xsolla.com/for/free-to-play-pc/account/), go to the **Players > Login** section. 2. Click **Configure** in the pane of a Login project. 3. Go to the **Authentication** block and select the **Miscellaneous data form** section. **End of audience: Free-to-play PC games** **Audience: Premium PC games** After you enable the request for email addresses and/or phone numbers in the account, your Login project will automatically: a. display forms to the user for entering their email address and/or phone number; b. after filling in the forms, send the user a code or a link to confirm the entered information; c. check the confirmation code and store the received information in the database. You can make it mandatory for users to complete the forms. To enable the collection of email addresses and phone numbers of users: 1. In your project in the [account](https://xsolla.com/for/premium-pc-games/account/), go to the **Players > Login** section. 2. Click **Configure** in the pane of a Login project. 3. Go to the **Authentication** block and select the **Miscellaneous data form** section. **End of audience: Premium PC games** **Audience: Web games** After you enable the request for email addresses and/or phone numbers in the account, your Login project will automatically: a. display forms to the user for entering their email address and/or phone number; b. after filling in the forms, send the user a code or a link to confirm the entered information; c. check the confirmation code and store the received information in the database. You can make it mandatory for users to complete the forms. To enable the collection of email addresses and phone numbers of users: 1. In your project in the [account](https://xsolla.com/for/web-games/account/), go to the **Players > Login** section. 2. Click **Configure** in the pane of a Login project. 3. Go to the **Authentication** block and select the **Miscellaneous data form** section. **End of audience: Web games** ![misc form](https://cdn.xsolla.net/developers/current/images/guides/login/features/misc-form.svg) 4. If you want your Login project to display a form where the user can specify their email address: a. Set the **Collect user email address** toggle to **On**. b. Select an email address confirmation method: **By code** or **By code and link**. 5. To require users to provide their email address, set the **Require user to complete email form** toggle to **On**. 6. If you want your Login project to display a form where the user can specify their phone number, set the **Collect user phone number** toggle to **On**. > [!NOTE] > Phone number confirmation is always done with a code sent via SMS. 7. To require users to provide their phone number, set the **Require user to complete phone number** toggle to **On**. 8. If you have enabled both the email address collection form and the phone number collection form, select the order in which they will be displayed to the user in the drop-down list at the bottom of the page. ### Collecting email addresses via Login API calls With the Login API, you can prompt users for their email addresses if they were not provided when registering through social networks. If you have integrated your Login project via [Login API calls](/authenticate-users/login/integration-guide/integrate-solution/): - When using the [Auth via social network](/api/login/social-login/jwt-auth-via-social-network/) call with a JWT standard, add the `fields=email` parameter. **Example of the request:** ```http GET https://login.xsolla.com/api/social/{providerName}/login_redirect?projectId={projectId}&fields=email&login_url={login_url} HTTP/1.1 ``` ```shell curl --request GET \ --url 'https://login.xsolla.com/api/social/providerName/login_redirect?projectId=projectId&fields=email&login_url=login_url' ``` - When using the [Auth via social network](/api/login/social-login/oauth-20-auth-via-social-network/) call with an OAuth 2.0 protocol, add the `scope=email` parameter. **Example of the request:** ```http GET https://login.xsolla.com/api/oauth2/social/{providerName}/login_redirect?scope=email&client_id={client_id}&redirect_uri={redirect_uri}&state={state}&response_type=code HTTP/1.1 ``` ```shell curl --request GET \ --url 'https://login.xsolla.com/api/oauth2/social/provider_name/login_redirect?scope=email&client_id=client_id&redirect_uri=redirect_uri&state=state&response_type=code' ```