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 Services ID for web login
info

If you are using an existing Services ID, select the corresponding Services ID from the Identifiers page, enable Sign in with Apple under Edit your Services ID Configuration, then click Configure to continue with step 6.

  1. Log in to the Apple Developer Platform. From the top navigation bar, click Account, then select Identifiers under Certificates, IDs & Profiles.

    Image:Apple Account

  2. Click the blue add icon (+).

    Image: Apple Identifiers

  3. Select Services IDs and click Continue.

    Image: Apple App ID

  4. Enter the Description and Identifier.

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

    Image: Register a new services ID on Apple Windows platform

  5. Under Capabilities, enable Sign in with Apple and click Configure.

  6. Under Return URLs, add the redirect links provided by Player Network, then click Save.

    Image: Register a new services ID on Apple Windows platform

  7. Click Continue > Register to create the Services ID for web login.

2. Create a private key to access services

Create a private key used to calculate the client_secret and the corresponding Key ID.

  1. In the Certificates, Identifiers & Profiles sidebar, select Keys.

  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. Get the Team ID
  1. Log in to the Apple Developer Platform.
  2. In the top navigation bar , tap Account and scroll down to find Membership details to view your team ID.

Image: Apple Team ID

For more information about configurations on Apple Developer Platform, see What the Heck is Sign In with Apple?.

  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);
});