Web
This document is intended to introduce how to set up X authentication so that your website can use Player Network's login authentication service to log in through the X channel.
Prerequisites
1. Set up your game on the X developer website
1. Create X application
It is recommended to use a Tencent email to register your account to improve the success rate in later applications.
Follow the prompts on the X Developer Website to register as a team developer or individual developer.With a developer account, you can create applications on the Developer Portal.
-
Create a new project as instructed.

-
Click the application you created.

-
Click Regenerate to obtain the API Key and API Secret Key.
This page will not be displayed again. Please make sure to save this information.

-
Click Set up.

-
Select Read And Write.

-
Select Web App under application type.

-
Add the test environment and production environment URLs as the callback URL.You will be directed to the official website of the game.Click Save Changes.
If the game is already live, you cannot delete the existing callback URL, only add new ones.
Supported for Player Network SDK V1.15 and earlier versions on Android/iOS platforms.
https://image.intlgame.com/v2/test/jssdk/twitterlogincallback.html
https://image.intlgame.com/v2/release/jssdk/twitterlogincallback.html
Supported for Player Network SDK V1.16 and higher versions on Android/iOS platforms and Windows platform.
https://test-common-web.intlgame.com/jssdk/twitterlogincallback.html
https://common-web.intlgame.com/jssdk/twitterlogincallback.html

2. Retrieve application information
You need the X App ID and secret to add X login channel in Player Network.

- Go to the Player Network Console to create a new project for your game or join an existing one.
- Add X as a login authentication method for your business in the Player Network Console.
For more information on integrating other third-party channels into SDK, please see JavaScript SDK.
Step 1: Import the JavaScript SDK
Both npm package and CDN methods are supported.
- npm
- CDN
$ npm install @intlsdk/account-api
// SDK production version package
<script src="https://common-web.intlgame.com/sdk-cdn/account-api/latest/index.umd.js"></script>
Step 2: Use the SDK
During integration testing, set env to the test environment; when the project goes live, set env to the corresponding production environment.
const accountApi = new IntlgameAccountApi({
env: "test", // SDK environment
gameID: 11,
});
| Parameter | Type | Description | Remarks |
|---|---|---|---|
| env | string | SDK environment For more information, see Get deployment cluster information. | Required |
| gameID | number | Player Network unique game ID | Required |
Step 3: Implement web login
After instantiating the accountApi component, call the thirdAuthorize interface to request the access token and access secret for the X channel.
accountApi.thirdAuthorize({
third_type: 'twitter',
}).then(
(res) => {
console.log(res);
});
After X returns the access token and key, call the intlAuthorize API to obtain the Player Network SDK OpenID and token to log in to the website.
accountApi.intlAuthorize({
third_type: 'twitter',
channel_info: {
oauth_token: "EAAI2lTrXAZBwBAC"
oauth_secret: "xxxx"
}
}).then(
(res) => {
console.log(res);
});
Call the intlLogout interface to log out from the website.
accountApi.intlLogout({
token: '4567xsdfsd',
openid: 'xxxxxxxx',
channel_id: 9,
}).then(
(res) => {
console.log(res);
});