엑솔라 로그인으로 Epic 온라인 서비스 사용 방법

작동 방식

Epic 온라인 서비스(EOS)는 개발자가 더 빠르고 쉽게 성공적으로 게임을 출시하고 조작하고, 크기를 조정할 수 있는 플랫폼 간 서비스입니다.

Epic 온라인 서비스 사용을 시작하려면 각 서비스에 대해 로그인 및 인터페이스 만들기를 설정해야 합니다. Epic 온라인 서비스는 외부 OpenID 공급자의 인증을 지원합니다. 이 방식으로 인증된 경우, 각 외부 공급자 사용자는 Epic 시스템에서 내부 OpenID를 받습니다.

사용자

런처엑솔라 로그인을 이미 통합한 파트너.

획득 방법

프로젝트 만들기 및 설정

  1. Epic 개발자 포털에서 새 상품을 만듭니다.
  1. 상품 설정으로 이동하세요.
  1. 클라이언트 자격증명 섹션을 열고 새 클라이언트를 누릅니다.
  1. 새 클라이언트를 만들고 매개 변수를 다음과 같이 작성하세요.
    • 클라이언트 이름 필드에 클라이언트 이름을 입력합니다.
    • 클라이언트 역할 필드에서 게임 서버를 선택합니다. 이를 통해 앱에게 세션 만들기에 대한 액세스 권한이 주어집니다.
  1. ID 공급자 섹션에서 OpenID 공급자를 선택하고 구성을 누릅니다.
  1. 나타나는 탭에서 새 항목을 누르고 다음과 같이 필드를 작성합니다.
    • UserInfo API 끝점 필드에 https://login.xsolla.com/api/users/me를 넣으세요. 이 URL은 Epic이 사용자 데이터에 대한 액세스 권한 요청을 보내는 엑솔라 로그인 메소드입니다. 응답으로 사용자 데이터가 있는 JSON 파일을 받게 됩니다.
    • HTTP 메소드에서 얻기를 선택하세요.
    • AccountId 이름 필드에 id를 입력하세요. 고유 사용자 ID를 가진 필드의 이름이 됩니다.
    • DisplayName 이름 필드external_id를 입력하세요. 외부 리소스가 사용할 수 있는 사용자 ID를 가진 필드의 이름이 됩니다.
  1. 만들어진 ID 공급자를 샌드박스에 추가하세요. 샌드박스 섹션에 가서 ID 공급자를 누르면 됩니다.
  1. 창의 Open ID 섹션에서 공급자를 지정하세요.

EOS SDK를 설정하려면 매개 변수 숫자가 필요합니다.

  • 상품 ID:

  • 샌드박스 ID:
  • 배포 ID:

샌드박스 > 배포에서 배포 목록을 볼 수 있습니다.

  • 클라이언트 ID:
  • 클라이언트 비밀:
  1. Epic 개발자 포털에서 대시보드 섹션으로 이동해 SDK를 다운로드하세요.
  1. 아카이브의 압축을 풀고 라이브러리를 내 프로젝트에 연결하세요.

EOS SDK 초기화

기능에 액세스 권한을 얻으려면 EOS SDK를 초기화하세요.

EOS SDK 초기화 코드 예시:

Copy
Full screen
Small screen
EOS_InitializeOptions SDKOptions;
SDKOptions.ApiVersion = EOS_INITIALIZE_API_LATEST;
SDKOptions.AllocateMemoryFunction = NULL;
SDKOptions.ReallocateMemoryFunction = NULL;
SDKOptions.ReleaseMemoryFunction = NULL;
SDKOptions.ProductName = "MyProduct";
SDKOptions.ProductVersion = "1.0";
SDKOptions.Reserved = NULL;
SDKOptions.SystemInitializeOptions = NULL;
EOS_Initialize(&SDKOptions);

초기화 후에 플랫폼 인터페이스는 사용 가능해집니다. 플랫폼 인터페이스는 다른 EOS SDK 구성 요소에 액세스 권한을 제공하는 개체입니다. 플랫폼 인터페이스를 만들려면, 프로젝트를 만든 후에 얻은 ID가 필요합니다.

EOS_Platform_Options 구조의 EOS_Platform_Create 함수를 호출하여 플랫폼 인터페이스를 만듭니다.

EOS_Platform_Options 구조 설명:

Copy
Full screen
Small screen
/** API version of EOS_Platform_Create. */
int32_t ApiVersion;
/** A reserved field that should always be nulled. */
void* Reserved;
/** The product id for the running application, found on the dev portal */
const char* ProductId;
/** The sandbox id for the running application, found on the dev portal */
const char* SandboxId;
/** Set of service permissions associated with the running application */
EOS_Platform_ClientCredentials ClientCredentials;
/** Is this running as a server */
EOS_Bool bIsServer;
/** Only used by Player Data Storage. Must be null initialized if unused. 256-bit Encryption Key for file encryption in hexadecimal format (64 hex chars)*/
const char* EncryptionKey;
/** The override country code to use for the logged in user. (EOS_COUNTRYCODE_MAX_LENGTH)*/
const char* OverrideCountryCode;
/** The override locale code to use for the logged in user. This follows ISO 639. (EOS_LOCALECODE_MAX_LENGTH)*/
const char* OverrideLocaleCode;
/** The deployment id for the running application, found on the dev portal */
const char* DeploymentId;
/** Platform creation flags, e.g. EOS_PF_LOADING_IN_EDITOR. This is a bitwise-or union of the defined flags. */
uint64_t Flags;
/** Only used by Player Data Storage. Must be null initialized if unused. Cache directory path. Absolute path to the folder that is going to be used for caching temporary data. The path is created if it's missing. */
const char* CacheDirectory;
/**
 * A budget, measured in milliseconds, for EOS_Platform_Tick to do its work. When the budget is met or exceeded (or if no work is available), EOS_Platform_Tick will return.
 * This allows your game to amortize the cost of SDK work across multiple frames in the event that a lot of work is queued for processing.
 * Zero is interpreted as "perform all available work"
 */
uint32_t TickBudgetInMilliseconds;

플랫폼 인터페이스를 만들 때 지정해야 할 매개 변수:

  • PlatformOptions.bIsServer 매개 변수의 값은 클라이언트를 만들 때 지정한 클라이언트 역할과 같아야 합니다.
  • PlatformOptions.CacheDirectory는 앱의 작업 디렉터리입니다.
  • PlatformOptions.ProductId, PlatformOptions.SandboxId, PlatformOptions.DeploymentId, PlatformOptions.ClientCredentials.ClientId, 그리고 PlatformOptions.ClientCredentials.ClientSecret은 프로젝트를 만들고 설정할 때 받은 값입니다.

Copy
Full screen
Small screen
EOS_Platform_Options PlatformOptions;
PlatformOptions.ApiVersion = EOS_PLATFORM_OPTIONS_API_LATEST;
PlatformOptions.Reserved = NULL;
PlatformOptions.bIsServer = false;
PlatformOptions.EncryptionKey = NULL;
PlatformOptions.OverrideCountryCode = NULL;
PlatformOptions.OverrideLocaleCode = NULL;
PlatformOptions.Flags = 0;
PlatformOptions.CacheDirectory = "path/to/cache/directory";

PlatformOptions.ProductId = "product id";
PlatformOptions.SandboxId = "sandbox id";
PlatformOptions.DeploymentId = "deployment id";
PlatformOptions.ClientCredentials.ClientId = "client id";
PlatformOptions.ClientCredentials.ClientSecret = "client secret";
EOS_HPlatform platformInterface = EOS_Platform_Create(&PlatformOptions);

EOS SDK가 초기화되었을 때, platformInterface 개체를 이용해 사용자 인증을 할 수 있습니다.

사용자 인증

EOS SDK를 초기화하고 플랫폼 인터페이스 개체를 만든 후에 준비 단계를 따라서 사용자 인증 요청을 실행하세요.

준비 단계

인증 메소드를 실행하기 전에, 타이머에서 EOS_Platform_Tick 메소드 호출을 설정합ong>platformInterface 개체를 인수로서 이 메소드에 전달합니다. 이는 권한 부여를 비롯한 다양한 메소드에 전달되는 콜백 함수의 실행을 보장합니다.

사용자 인증 요청

외부 공급자의 인증은 connectInterface 개체로 수행됩니다. 이 개체를 얻으려면 다음 코드를 실행하세요.
Copy
Full screen
Small screen
EOS_HConnect connectInterface = EOS_Platform_GetConnectInterface(platformInterface);

platformInterface이 플랫폼 인터페이스 EOS SDK 초기화 단계에서 받은 플랫폼 인터페이스인 곳.

connectInterface 개체를 얻은 후에 EOS_Connect_Login 메소드를 호출하고 매개 변수를 다음과 같이 전달하세요.

  • connectInterface는 전 단계에서 받은 연결 인터페이스입니다.
  • EOS_Connect_LoginOptions 구조. 아래 설명을 참조하세요.
  • void *clientDataCompletionDelegate 콜백 함수를 실행할 때 다시 전달되는 데이터입니다.
  • CompletionDelegate는 인증 프로세스 종료 후에 실행되어야 하는 콜백 함수입니다.

메소드에 전달되는 EOS_Connect_LoginOptions 구조는 다음과 같이 작성되어야 합니다.

Copy
Full screen
Small screen
EOS_Connect_LoginOptions loginOptions;
loginOptions.ApiVersion = EOS_CONNECT_LOGIN_API_LATEST;
loginOptions.UserLoginInfo = NULL;
loginOptions.Credentials = &connectCredentials;

connectCredentials이 사용자 토큰을 포함하는 EOS_Connect_Credentials 구조인 곳. 다음과 같이 작성하세요.

Copy
Full screen
Small screen
EOS_Connect_Credentials connectCredentials;
connectCredentials.ApiVersion = EOS_CONNECT_CREDENTIALS_API_LATEST;
connectCredentials.Token = "jwt token";
connectCredentials.Type = EOS_EExternalCredentialType::EOS_ECT_OPENID_ACCESS_TOKEN;

코드에 추가할 데이터:

  • connectCredentials.Token, 사용자 JWT 토큰. 게임은 이를 런처에서 런처 인수로서 받았습니다. 인수 유형.
  • connectCredentials.Type, 인증 유형. 외부 OpenID 공급자의 인증에 대해 예시가 주어졌습니다.

구조를 만들고 옵션과 작성 후에 EOS_Connect_Login메소드 호출 방법:

Copy
Full screen
Small screen
EOS_Connect_Login(
  connectHandle,
  &loginOptions,
  NULL,
  &onLoginConnect
);

인증 프로세스가 끝나면 onLoginConnect 정적 함수가 호출됩니다. 다음과 같이 선언하세요.

Copy
Full screen
Small screen
static void EOS_CALL onLoginConnect(const EOS_Connect_LoginCallbackInfo *Data);

*Data가 인증 시도에 대한 데이터를 포함하는 EOS_Connect_LoginCallbackInfo 구조에 대한 포인터인 곳.

구조 설명:

Copy
Full screen
Small screen
/** Result code for the operation. EOS_Success is returned for a successful query, otherwise one of the error codes is returned. See eos_result.h */
EOS_EResult ResultCode;
/** Context that was passed into EOS_Connect_Login */
void* ClientData;
/** If login was successful, this is the account ID of the local player that logged in */
EOS_ProductUserId LocalUserId;
/**
* If the user was not found with credentials passed into EOS_Connect_Login,
* this continuance token can be passed to either EOS_Connect_CreateUser
* or EOS_Connect_LinkAccount to continue the flow
*/
EOS_ContinuanceToken ContinuanceToken;

콜백 함수 예시:

Copy
Full screen
Small screen
static void EOS_CALL onLoginConnect(const EOS_Connect_LoginCallbackInfo *Data) {
  if (Data->ResultCode == EOS_EResult::EOS_InvalidUser) {
    continuanceToken = Data->ContinuanceToken;
  }
  if (Data->ResultCode == EOS_EResult::EOS_Success) {
    userId = Data->LocalUserId;
  }
}

인증이 진행될 때, 시스템은 외부 공급자 계정과 연결된 Epic 계정이 있는지 확인합니다.

이 유형의 Epic 계정이 있는 경우:

  • Data 개체에서 ResultCode 매개 변수가 EOS_EResult::EOS_Success (0) 값을 반환합니다.
  • Data 개체에서 LocalUserId 매개 변수가 계정 ID을 반환합니다. 이를 다른 Epic 서비스와의 향후 상호 작용을 위해 저장합니다.

연결된 Epic 계정이 없는 경우:

  • Data 개체에서 ResultCode 매개 변수가 OS_EResult::EOS_InvalidUser (3) 값을 반환합니다.
  • Data->ContinuanceToken 매개 변수가 인증 시도에 대한 데이터를 반환합니다. 이를 새로운 Epic 사용자 만들기에 저장하고 외부 공급자 계정과 연결하세요.

Epic 사용자를 만들려면 EOS_Connect_CreateUser메소드를 호출하세요. 아래 코드 예시를 참고하세요.

  • connectHandle은 내가 이미 사용한 connectInterface개체입니다.
  • options는 전 단계에서 내가 받은 continuanceToken을 포함하는 EOS_Connect_CreateUserOptions 구조입니다.
  • NULL는 전 단계에서 EOS_Connect_Login 메소드와 함께 받은 clientData입니다.
  • onCreateUser는 전 단계에서 함수와 함께 계정을 만든 후에 호출된 정적 콜백 함수입니다.

Copy
Full screen
Small screen
EOS_Connect_CreateUserOptions options;
options.ApiVersion = EOS_CONNECT_CREATEUSER_API_LATEST;
options.ContinuanceToken = continuanceToken;
EOS_Connect_CreateUser(
  connectHandle,
  &options,
  NULL,
  &onCreateUser
);

onCreateUser 기능 예시:

Copy
Full screen
Small screen
static void EOS_CALL onCreateUser(const EOS_Connect_CreateUserCallbackInfo *Data) {
  if (Data->ResultCode == EOS_EResult::EOS_Success) {
    userId = Data->LocalUserId;
  }
}
/** Result code for the operation. EOS_Success is returned for a successful query, otherwise one of the error codes is returned. See eos_result.h */
EOS_EResult ResultCode;
/** Context that was passed into EOS_Connect_CreateUser */
void* ClientData;
/** Account ID of the local player created by this operation */
EOS_ProductUserId LocalUserId;

Epic 사용자 계정이 성공적으로 만들어지고 외부 공급자 계정과 연결된 경우:

  • Data 개체에서 ResultCode 매개 변수가 EOS_EResult::EOS_Success (0) 값을 반환합니다.
  • Data 개체에서 LocalUserId 매개 변수가 계정 ID을 반환합니다. 이를 다른 Epic 서비스와의 향후 상호 작용을 위해 저장합니다.

이 기사가 도움이 되었나요?
감사합니다!
개선해야 할 점이 있을까요? 메시지
유감입니다
이 기사가 도움이 안 된 이유를 설명해 주세요. 메시지
의견을 보내 주셔서 감사드립니다!
메시지를 검토한 후 사용자 경험 향상에 사용하겠습니다.
이 페이지 평가
이 페이지 평가
개선해야 할 점이 있을까요?

답하기 원하지 않습니다

의견을 보내 주셔서 감사드립니다!
마지막 업데이트: 2024년 1월 31일

오자 또는 기타 텍스트 오류를 찾으셨나요? 텍스트를 선택하고 컨트롤+엔터를 누르세요.

문제 보고
콘텐츠를 항상 검토합니다. 여러분의 피드백은 콘텐츠를 개선에 도움이 됩니다.
후속 조치를 위해 이메일을 제공해 주세요
의견을 보내 주셔서 감사드립니다!