Skip to main content

Windows

This document aims to introduce how to set up Apple authentication to enable your game to log in and authenticate through the Apple channel using Player Network services.

Prerequisites

1. Configure iOS Applications on Apple Developer
1. Create Services ID
info

If you are using an existing Services ID, click the corresponding Services ID on the Identifiers page, open the Sign in with Apple option under Edit your Services ID Configuration, and click Configure. Continue to step 6.

  1. Log in to Apple Developer, click Account in the top navigation bar, and 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

  1. Enter Description and Identifier.

    • Description: The name or description of the game application.
    • Identifier: Unique identifier.

    Image: Apple bundle description

  2. Under Capabilities, open the Sign in with Apple option, then click Configure.

  3. Under Return URLs, add the redirect link provided by Player Network, then click Save.

    Image: Register a new services ID on Apple Windows platform

  4. Click Continue > Register to create a Services ID.

2. Create a Key for Accessing Services

Create a key for calculating client_secret and the corresponding Key ID.

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

  2. Click the blue add icon (+).

    Image: Apple Key

  3. Enter a unique name for the key under Key Name.

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

    Image: Apple Key Name

  5. Under Primary App ID, select the App ID created in the previous step, then 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 (can only be downloaded once, do not lose it), saved as a text file with a .p8 extension.

3. Obtain Team ID
  1. Log in to Apple Developer.

  2. In the top navigation bar, click Account and scroll down to find Membership details to view Team ID.

    Image: Apple Team ID

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

  1. Obtain Player Network Console login account.
  2. Create a new project for your game, or join an existing one.
  3. Download SDK.
  4. Integrate SDK.
  5. Add Apple as a login authentication method in Player Network Console.

Step 1: Configure SDK for Apple Login

Open your project's INTLConfig.ini file:

[Apple]
APPLE_WEB_APP_ID = {INTL_APPLE_WEB_APP_ID}

Replace {INTL_APPLE_WEB_APP_ID} with the game's Apple Web APPLICATION ID.

Step 2: Add Apple Login

caution
  1. Apple login cannot be tested with re-signed packages, it is recommended to use TestFlight or Dev packaging.
  2. Apple login does not provide PictureUrl (user avatar URL).For more information, see INTLAuthResult for Unity engine or FINTLAuthResult for Unreal Engine.

Login interface permission parameter passes email and fullName:

  • On the first login screen, there are options to edit the username and hide the email (Fig 2).In the callback, email and fullName can be obtained.
    • If the player chooses to hide the email, the obtained email will be a random email address.
    • If the player chooses to share the email, the user's real email address will be obtained.
  • On subsequent logins, email and fullName will not be obtained, and the login screen (Fig 2) will not have options to edit the username or hide the email.
  • If the player stops using the app with Apple ID and logs in again, the options shown in Fig 1 will be displayed.
info

Players can choose Settings > [Your Username] > Password & Security > Use Apple ID > [App Name] > Stop Using Apple ID to stop the app from continuing to use Apple ID login.

When passing an empty string for the login interface permission parameters, the login screen will not have options to edit the username or hide the email (Fig 2).In callback, email and fullName are empty.

Fig 1:
Image: apple_login_permission

Fig 2:
Image: apple_login_permission2

  1. Register login related callbacks.
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
}

// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
}

// Process the INTLAuthResult callback
public void OnAuthResultEvent(INTLAuthResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");

string methodTag = "";
if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_LOGIN)
{
methodTag = "Login";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
{
methodTag = "Bind";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_AUTOLOGIN)
{
methodTag = "AutoLogin";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO)
{
methodTag = "QueryUserInfo";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT)
{
methodTag = "GetAuthResult";
}
}
  1. Call the AutoLogin method for automatic login.
INTLAPI.AutoLogin();
  1. If automatic login fails, call the Login method to let players log in manually.
INTLAPI.Login(INTLChannel.Apple); 
  1. Synchronize client authentication status with the game backend, waiting for final validation results.

[Optional] Set email permission

note

Apple requires player authorization to obtain player email; if authorization is denied, the player email cannot be obtained. See Passing email and fullName in Login interface for details.

To obtain the player's email during Apple login, set the corresponding permissions first. Once enabled, email is returned in ChannelInfo of AuthResult.

  • For compliance considerations, masking of returned email for specific origins can be done. Please contact Player Network Assistant to enable it if needed.
  • In the background log, you can report the hash of base64(sha256(email)). Contact Player Network Assistant if needed.
  • Can be used to verify whether the player's information or the binding list contains email information. Contact Player Network Assistant if needed.
  1. When calling the Login interface, add the email permission in the permissions parameter.

  2. Enable the email return feature in the Player Network Console by setting return_email to YES. For details, see Third-Party Channel Configuration.

Step 3: Acceptance Test for Login Functionality

Search for the keyword "AuthResult" in the Player Network SDK logs to confirm whether the channel name and OpenID are returned correctly.If correct, it means the integration configuration is successful, and login functionality has been successfully added.

If you encounter problems during the integration process, please refer to Frequently Asked Questions.