This document is about: PUN 2
SWITCH TO

PUN Classic (v1), PUN 2, Bolt는 휴업 모드입니다. Unity2022에 대해서는 PUN 2에서 서포트하지만, 신기능의 추가는 없습니다. 현재 이용중인 고객님의 PUN 및 Bolt 프로젝트는 중단되지 않고, 퍼포먼스나 성능이 떨어지는 일도 없습니다. 앞으로의 새로운 프로젝트에는 Photon Fusion 또는 Quantum을 사용해 주십시오.

Epic EOS Authentication

Application Setup

Adding Epic / EOS as authentication provider is easy and it could be done in few seconds from your Photon Applications' Dashboard.
Go to the "Manage" page of an application and scroll down to the "Authentication" section.

Mandatory Settings

  • clientid: Client ID used to authenticate the user with Epic Account Services (used for ID Token validation). Hint: this value can be (currently) found in the EOS dashboard > Product Settings > Clients ( > Details > Client ID)
  • catalogitemids (optional): Catalog items which have to be owned, entries separated by semicolon. NOTE: key can’t be removed and value can’t be empty in dashboard. If ownership check is not required use “none” or “0” as value.

Client Side

Clients have to send:

  • token: ID Token (see ”Retrieving an ID Token For User” below)
  • ownershipToken (optional): if catalogItemIds are configured in dashboard client has to send ownershipToken, NS verifies that items are owned

Retrieving an ID Token

Clients have to use the Epic Account Service API to fetch an ID Token, which is described in Epic's "Auth Interface - Retrieving an ID Token For User" doc.

Excerpt from Epic's documentation: “Game clients can obtain ID Tokens for local users by calling the EOS_Auth_CopyIdToken SDK API after the user has been logged in, passing in a EOS_Auth_CopyIdTokenOptions structure containing the EOS_EpicAccountId of the user.

The outputted EOS_Auth_IdToken structure contains the EOS_EpicAccountId of the user, and a JWT representing the ID Token data. Note, you must call EOS_Auth_IdToken_Release to release the ID Token structure when you are done with it.

Once retrieved, the game client can then provide the ID Token to another party. An ID Token is always readily available for a logged in local user.”

Sample Code

This can be used to retrieve an ID Token:

C#

// Call this method after login.
private bool GetLocalIdToken(out IdToken? a_IdToken)
{
    var options = new CopyIdTokenOptions()
    {
        AccountId = LocalUserId
    };
    
    // NOTE: Make sure to use the EOSAuthInterface to get the IdToken instead of the EOSConnectInterface.
    var result = EOSManager.Instance.GetEOSAuthInterface().CopyIdToken(ref options, out a_IdToken);
    
    if (result != Result.Success)
    {
        Debug.LogError("Failed to copy the IdToken.");
        return false;
    }

    return true;
}

And the AuthValues can be setup like this:

C#

var authValues = new AuthenticationValues();
authValues.AuthType = CustomAuthenticationType.Epic;

var idToken = /* token retrieved by GetLocalIdToken */;
authValues.AddAuthParameter("token", idToken.Value.JsonWebToken.ToString());

Client.AuthValues = authValues;

Requesting an Ownership Verification Token

Epic's documentation describes how to get the optional Ownership Verification Token.

Back to top