Skip to main content

Web

This article guides you through setting up Apple as an identity provider, enabling your iOS game to access Player Network authentication services.

Prerequisites

1. Set up the Apple app on the Apple Developer Platform
1. Create a Service ID for web login
  1. Log in to the Apple Developer Platform.

  2. In the sidebar, click Certificates, IDs & Profiles.

  3. In the sidebar, click Identifiers and click the blue add icon (+).

    Image: Apple Identifiers

  4. Select Services IDs and click Continue.

  5. Enter the Description and Identifier.

    • Description: The name or description of the game app displayed during user login
    • Identifier: The unique identifier for web.

    Image: Register a new services ID on Apple Windows platform

  6. Under Capabilities, select the checkbox next to Sign in with Apple, and click Configure.

  7. Under Return URLs, enter the redirect link provided by Player Network.

    Image: Register a new services ID on Apple Windows platform

  8. Click Save and then click Continue and Register to create a Service ID for web login.

2. Create a key to access enabled capabilities
  1. In Certificates, IDs & Profiles, click Keys in the sidebar.

  2. Click the the blue add icon (+).

    Image: Apple Key

  3. Under Key Name, enter a unique name for the key.

  4. Select the checkbox next to Sign in with Apple, and click Configure.

    Image: Apple Key Name

  5. Under Primary App ID, select the Service ID created in Step 1 and click Save.

    Image: Apple Save Primary Key

  6. Click Continue.

  7. Click Register to generate the key, and note down the Key ID.

  8. Click Download to download the key file (you can only DOWNLOAD IT ONCE, DO NOT lose it) which is saved as a text file with a .p8 file extension.

3. Create a description file

Create and download a description file. Then, install the downloaded description file in the development or packaging environment.

4. Get the Team ID
  1. Log in to the Apple Developer Platform.
  2. In the sidebar, click Membership to view the Team ID.

Image: Apple Team ID

  1. Create an account for Player Network Console.
  2. Create a new project for your game, or join an existing one.
  3. Add Apple as an authentication method for your project on Player Network Console.
note

For more details about integrating the SDK for other third-party channels, see JavaScript SDK.

Step 1: Install the JavaScript SDK

caution

Install the SDK package from the production environment when launching the game. The SDK package from the test environment is only used for integration testing.

Install the JavaScript SDK from npm or CDN.

$ npm install @intlsdk/account-api

Step 2: Instantiate the SDK

caution

Set env to the test environment during the integration testing and env to the corresponding production environment when launching the game.

const accountApi = new IntlgameAccountApi({
env: "test", // SDK environment
gameID: 11,
});
ParameterTypeDescriptionRemark
envstringSDK environment
For more information, see Retrieve cluster information.
Required
gameIDnumberUnique game ID assigned by Player NetworkRequired

Step 3: Implement web login

After instantiating the accountApi component, call the thirdAuthorize method to request the access token from Discord.

accountApi.ThirdAuthorize({
third_type: 'apple',
extra: {
appleAppId: 'xxxxx', // Required for apple login
}
}).then(
(res) => {
console.log(res);
});

With the Discord token returned, call the intlAuthorize method to get the Player Network SDK OpenID and token to log in to your website.

accountApi.intlAuthorize({
third_type: 'apple',
channel_info: {
code: "EAAI2lTrXAZBwBAC"
user_name: "EAAI2lTrXAZBwBAC"
}
}).then(
(res) => {
console.log(res);
});

Call the intlLogout method to log out from your website.

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