Skip to main content

Windows

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

Prerequisites

1. Set up the Apple app on the Apple Developer Platform
1. Create an App ID

Create a client_id to identify the source that sends a request to Apple.
For iOS apps, the client_id will be the App ID (Bundle ID).

  1. Log in to the Apple Developer Platform.

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

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

    Image: Apple Identifiers

  4. Select App IDs and click Continue.

    Image: Apple App ID

  5. Enter the Description and Bundle ID.

    • Description: The name or description of the game app.
    • Bundle ID: The unique identifier of the game app which is included in the app ID.

    Image: Apple bundle description

  6. Under Capabilities, select Sign in with Apple and click Continue.

  7. Click Register to create an App ID.

info

For an existing App ID, find the designated App ID and select Sign in with Apple under Capabilities.

2. Create a private key to access services

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

  1. From Certificates, Identifiers & 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 app ID created in the previous step 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 (CAN ONLY BE DOWNLOADED 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

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. Download the SDK.
  4. Integrate the SDK.
  5. Add Apple as an authentication method for your project on Player Network Console.

Step 1: Configure the SDK for Apple login

Open the project's INTLConfig.ini:

[Apple]
APPLE_WEB_APP_ID = {INTL_APPLE_WEB_APP_ID}
  • Replace {INTL_APPLE_WEB_APP_ID} with the Apple Web APPLICATION ID of the game.

Step 2: Add Apple login

caution
  1. It is not possible to test Apple login on a re-signed package. It is recommended to use TestFlight or Dev package.
  2. Apple login does not provide PictureUrl(User avatar URL). For more information, see INTLAuthResult for Unity and FINTLAuthResult for UE.

Passing email and fullName as login permission parameters to the Login API:

  • During first login, the username can be edited and an option to hide email is available (Fig 1). email and fullName can be obtained from the callback.
    • If the player chose to hide their email, a random address will be returned.
    • If the player chose to share their email, the actual email address will be returned.
  • email and fullName will not be returned on subsequent logins, and the login interface (Fig 2) will not provide options to edit username or hide email.
  • If the user stops the app from using the Apple ID and then logs in again, the interface will show the options in Fig 1.
info

Players can go to Settings > [Your Username] > Password and Security > Apps using Apple ID > [App Name] > Stop using Apple ID to stop or allow apps to use Apple ID for login.

When the Login method login permission parameters pass in null strings, the login interface will not provide options to edit username and hide email (Fig 2). In the callback, the email and fullName fields are null.

Fig 1:
Image: apple_login_permission

Fig 2:
Image: apple_login_permission2

  1. Add an observer to handle authentication 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";
    }
    }
  2. Call the AutoLogin method.

    INTLAPI.AutoLogin();
  3. Call the Login method to ask for user input if auto-login fails.

    INTLAPI.Login(INTLChannel.Apple); 
  4. Sync client authentication state with the game's backend and wait for the final authentication result.

[Optional] Set up email permissions

note

Player authorization is required to obtain the email address for Apple, and will not be available if player authorization is refused, see Passing email and fullName to the Login API for more information.

Set up permissions to obtain the email address of players during Apple login, returned as email in the ChannelInfo of AuthResult.

  • Email masking can be performed on the returned email according to compliance requirements, reach out to the Player Network representative to enable this feature.
  • The hashed base64(sha256(email)) can be reported to the backend logs, reach out to the Player Network representative to enable this feature.
  • Can be used to verify if email is present in a player's profile or third-party channel information, reach out to the Player Network representative to enable this feature.
  1. Add email to the permissions parameter when calling the Login API.

  2. Enable email return on Player Network Console by setting return_email to YES, see Configure Third-party Channels for detailed procedures.

Step 3: Test the login function

Search for the keyword "AuthResult" in the Player Network SDK logs to verify if the correct channel name and OpenID are returned. If they are, it indicates a successful configuration and the login function has been added successfully.