Skip to main content

Web

The purpose of this article is to describe how to set up Epic authentication so that your web pages can log in through the Epic channel using the Player Network Login Authentication Service.

Prerequisites

  1. Configure the application on the Epic Developer Portal.
  2. Add developer members to the organization and give role permissions.
  3. Obtain Player Network Console login account.
  4. Create a new project for your game, or join an existing one.
  5. Add Epic as the login authentication method for the business in the Player Network console.
note

For more information about integrating other third-party channels into the SDK, see JavaScript SDK.

Step 1: Introduce JavaScript SDK

caution

During project integration testing, import the debugging SDK package, which is intended only for integration testing.For project launch, the official SDK package must be imported.

Currently supports npm package method and CDN method.

$ npm install @intlsdk/account-api

Step 2: Use SDK

caution

During integration testing, set env to test environment; Set env to the corresponding official environment when the project goes live.

const accountApi = new IntlgameAccountApi({
env: "test", // SDK environment
gameID: 11,
});
ParameterTypeDescriptionRemarks
envstringSDK environment
For more information, see Obtain deployment cluster information.
Required
gameIDnumberUnique Player Network Game IDMandatory

Step 3: Implement Web Login

After instantiating the accountApi component, call the thirdAuthorize interface to request an access token for the Epic channel.

accountApi.thirdAuthorize({
third_type: 'epic',
}).then(
(res) => {
console.log(res);
});

When Epic returns the access token, call the intlAuthorize interface to get the Player Network SDK OpenID and token to log into the site.

accountApi.intlAuthorize({
third_type: 'epic',
channel_info: {
openid: "EAAI2lTrXAZBwBAC" //the response parameter account_id returned from the thirdAuthorize interface
nickname: "EAAI2lTrXAZBwBAC"
access_token: "EAAI2lTrXAZBwBAC"
refresh_token: "EAAI2lTrXAZBwBAC"
expires_in: "EAAI2lTrXAZBwBAC"
refresh_expires_in: "EAAI2lTrXAZBwBAC"
}
}).then(
(res) => {
console.log(res);
});

Call the intlLogout API to log out from the website.

accountApi.intlLogout({
token: '4567xsdfsd',
openid: 'xxxxxxxx',
channel_id: 24,
}).then(
(res) => {
console.log(res);
});