Skip to main content

Windows

The purpose of this article is to describe how to set up Epic authentication so that your game can be logged in through the Epic channel using the Player Network Login Authentication Service.

Prerequisites

  1. Configure the application on the Epic Developer Portal.
  2. Add developer members to the organization and give role permissions.
  3. Obtain a Player Network Console login account.
  4. Create a new project for your game or join an existing project.
  5. Download SDK.
  6. Integrate SDK.
  7. Add Epic as the login authentication method for the business in the Player Network console.

Step 1:Configure SDK for Epic Login

  1. Select your product at Epic Developer Portal.

  2. Click Product Settings and select SDK Download & Credentials.

  3. Click Use credentials in header file under EOS SDK Credentials to use the generate header file function. Epic Generate Head File

  4. Complete the required information and click I understand after confirming the displayed instructions.The automatically generated information can be copied by clicking on the copy icon in the upper right corner.

    • Deployment:Deployment environment, recommended Live, no need to reconfigure when product goes live
    • Client:Client name
    • Application:Product name

    Epic Generate Head File Result

  5. Configure the generated information into the INTLConfig.ini file.

    [Epic]
    EPIC_PRODUCT_NAME = {INTL_EPIC_PRODUCT_NAME}
    EPIC_PRODUCT_VERSION = {INTL_EPIC_PRODUCT_VERSION}
    EPIC_PRODUCT_ID = {INTL_EPIC_PRODUCT_ID}
    EPIC_SANDBOX_ID = {INTL_EPIC_SANDBOX_ID}
    EPIC_DEPLOYMENT_ID = {INTL_EPIC_DEPLOYMENT_ID}
    EPIC_CLIENT_ID = {INTL_EPIC_CLIENT_ID}
    EPIC_CLIENT_SECRET = {INTL_EPIC_CLIENT_SECRET}
    • Replace {INTL_EPIC_PRODUCT_NAME} with the product name.
    • Replace {INTL_EPIC_PRODUCT_VERSION} with a customized string indicating the product version number, such as "1.0".
    • Replace {INTL_EPIC_PRODUCT_ID} with the value of ProductId[].
    • Replace {INTL_EPIC_SANDBOX_ID} with the value of SandBoxId[].
    • Replace {INTL_EPIC_DEPLOYMENT_ID} with the value of DeploymentId[].
    • Replace {INTL_EPIC_CLIENT_ID} with the value of ClientCredentialsId[].
    • Replace {INTL_EPIC_CLIENT_SECRET} with the value of ClientCredentialsSecret[].

Step 2:Add Epic Login

caution

If the project has not been published on the Epic Games platform, a warning will be displayed when you log in.Only team members can log in properly.
Image: Epic Unverified Application

  • Configure the required login permissions on the Epic Account Services page.For more information, see Epic Account Services Data Privacy and Visibility.

    • basic_profile:The basic profile is the minimum level of access required to retrieve any information about an Epic account.
    • friends_list:Applications can access the friends list of an Epic account through the Friends List Access permission.
    • presence:The presence access level allows applications to access the account's presence information. Epic_Permission_Setting Epic_Modify_Permission
  • Add UpdateSDK calls to ensure that Epic's asynchronous callback functionality works properly.

note

The Player Network SDK in PC applications only supports AccountPortal login mode.In this mode the Epic EOS SDK will open the login page in the system browser and use the locally stored Long Term Access Token to login to the network.For more information, see Persistent Login for Epic Account Users Outside of Epic Games Launcher.

note

Epic 支持将登录状态从一个进程传递给子进程,因此子进程无需额外的用户输入即可获取登录到父进程的 Epic 账号的登录状态信息。这一过程由刷新令牌完成,更多信息请参见 EOS API reference page for EOS_ELoginCredentialType

Usage Scenarios:If the game needs to be launched via the launcher, the game will be opened after logging into Epic on the launcher.Since the launcher and the game are different processes, the game process cannot use the Epic login state from the launcher.If the game requires Epic login status (for example for payments), it can login to Epic by using a refresh token without any input from the player.

The Player Network SDK supports obtaining refresh tokens for Epic channels.After logging into the Epic using the Player Network SDK, the Player Network SDK returns the Epic's refresh token in the ChannelInfo field of the login result.Once the game process obtains a refresh token from the parent process, it can use the refresh token to log into the Epic.

  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 interface to log in automatically.
INTLAPI.AutoLogin();
  1. If automatic login fails, call the Login interface to let the player log in manually.
string refreshToken; //refresh token from another proccess
StringBuilder Extra_Json = new StringBuilder();
Extra_Json.Append("{");
Extra_Json.Append("\"")
.Append("LoginMode")
.Append("\"")
.Append(":")
.Append("\"")
.Append("RefreshToken")
.Append("\",");
Extra_Json.Append("\"")
.Append("Token")
.Append("\"")
.Append(":")
.Append("\"")
.Append(refreshTokentoken)
.Append("\"");
Extra_Json.Append("}");
string channel = "Epic";
string permissions = "basic_profile,friends_list,presence"; //permissions for epic
string extraJson = Extra_Json.ToString();

INTLAPI.Login(channel, permissions, extraJson);
  1. Synchronize client authentication status with the game backend and wait for the final verification result.

Step 3: Acceptance testing 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.