-
Notifications
You must be signed in to change notification settings - Fork 2
Connect
Epic Online Services Interface: Connect Interface
The Connect Interface enables an external identity provider to integrate with and use the Epic Online Services (EOS) ecosystem.
These functions are provided for handling connectivity:
- EpicGames_Connect_AddNotifyAuthExpiration
- EpicGames_Connect_AddNotifyLoginStatusChanged
- EpicGames_Connect_CopyIdToken
- EpicGames_Connect_CopyProductUserInfo
- EpicGames_Connect_CreateUser
- EpicGames_Connect_GetLoginStatus
- EpicGames_Connect_Login
- EpicGames_Connect_RemoveNotifyAuthExpiration
- EpicGames_Connect_RemoveNotifyLoginStatusChanged
These are the structures used by this API:
Epic Online Services Function: EOS_Connect_AddNotifyAuthExpiration
This function registers to receive upcoming authentication expiration notifications. Notification is approximately 10 minutes prior to expiration. Call EpicGames_Connect_Login again with valid third-party credentials to refresh access.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.
Syntax:
EpicGames_Connect_AddNotifyAuthExpiration()
Returns:
N/A
Triggers:
Key | Type | Description |
---|---|---|
type | String | The string "EpicGames_Connect_AddNotifyAuthExpiration"
|
identifier | Real | The asynchronous listener ID. |
Example:
identifier = EpicGames_Connect_AddNotifyAuthExpiration();
The code sample above save the identifier that can be used inside a Social Async Event.
if (async_load[? "type"] == "EpicGames_Connect_AddNotifyAuthExpiration")
{
if (async_load[? "status"] == EpicGames_Success)
{
show_debug_message(async_load[? "type"] + " succeeded!");
}
else
{
show_debug_message(async_load[? "type"] + " failed: " + async_load[? "status_message"]);
}
}
The code above matches the response against the correct event type and logs the success of the task.
Epic Online Services Function: EOS_Connect_AddNotifyLoginStatusChanged
This function registers to receive user login status updates.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.
Syntax:
EpicGames_Connect_AddNotifyLoginStatusChanged()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
type | String | The string "EpicGames_Connect_AddNotifyLoginStatusChanged"
|
CurrentStatus | EpicGames_Login_Status | The status at the time of the notification |
PrevStatus | EpicGames_Login_Status | The status prior to the change |
Example:
identifier = EpicGames_Connect_AddNotifyLoginStatusChanged();
The code sample above save the identifier that can be used inside a Social Async Event.
if (async_load[? "type"] == "EpicGames_Connect_AddNotifyLoginStatusChanged")
if (async_load[? "identifier"] == identifier)
{
if (async_load[? "status"] == EpicGames_Success)
{
show_debug_message(async_load[? "type"] + " succeeded!");
}
else
{
show_debug_message(async_load[? "type"] + " failed: " + async_load[? "status_message"]);
}
}
The code above matches the response against the correct event type and logs the success of the task.
Epic Online Services Function: EOS_Connect_CopyIdToken
This function fetches an ID token for a Product User ID.
Syntax:
EpicGames_Connect_CopyIdToken(user)
Argument | Type | Description |
---|---|---|
user | String | The local Product User ID whose ID token should be copied. |
Returns:
Example:
var _struct = EpicGames_Connect_CopyIdToken(user);
if(_struct.status = EpicGames_Success)
{
JsonWebToken = _struct.JsonWebToken;
}
The above code shows an example of how the function should be used. The JWT associated with the provided product user ID is returned inside the struct, alongside other useful information.
Epic Online Services Function: EOS_Connect_CopyProductUserInfo
This function fetches information about a Product User, using the external account that they most recently logged in with as the reference.
Syntax:
EpicGames_Connect_CopyProductUserInfo(userID_target)
Argument | Type | Description |
---|---|---|
userID_target | String | Product user ID to look for when copying external account info from the cache. |
Returns:
Example:
var _struct = EpicGames_Connect_CopyProductUserInfo(userID_target);
if(_struct.status == EpicGames_Success)
{
// access the data here
}
The above code shows an example of how the function should be used.
Epic Online Services Function: EOS_Connect_CreateUser
This function creates an account association with the Epic Online Services as a product user given their external auth credentials.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.
Syntax:
EpicGames_Connect_CreateUser()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
type | String | The string "EpicGames_Connect_CreateUser"
|
status | EpicGames_Result | The status code for the operation. EpicGames_Success indicates that the operation succeeded; other codes indicate errors |
status_message | String | Text representation of the status code |
identifier | Real | The asynchronous listener ID. |
LocalUserId | String | If the operation succeeded, this is the Product User ID of the local user who was created. |
Example:
identifier = EpicGames_Connect_CreateUser();
The code sample above saves the identifier that can be used inside a Social Async Event.
if (async_load[? "type"] == "EpicGames_Connect_CreateUser")
if (async_load[? "identifier"] == identifier)
{
if (async_load[? "status"] == EpicGames_Success)
{
show_debug_message(async_load[? "type"] + " succeeded!");
}
else
{
show_debug_message(async_load[? "type"] + " failed: " + async_load[? "status_message"]);
}
}
The code above matches the response against the correct event type and logs the success of the task.
Epic Online Services Function: EOS_Connect_GetLoginStatus
This function fetches the login status for a Product User ID. This Product User ID is considered logged in as long as the underlying access token has not expired.
Syntax:
EpicGames_Connect_GetLoginStatus(user)
Argument | Type | Description |
---|---|---|
user | String | The Product User ID of the user being queried. |
Returns:
Example:
if(EpicGames_Connect_GetLoginStatus(user) == EpicGames_LS_LoggedIn)
show_debug_message(user + ": is logged");
else
show_debug_message(user + ": not logged");
The above code shows an example of how the function should be used. A login status constant is returned and checked against the provided built-in constants.
Epic Online Services Function: EOS_Connect_Login
This function logs in / authenticates given a valid set of external auth credentials.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.
Syntax:
EpicGames_Connect_Login(type, access_token, display_name)
Argument | Type | Description |
---|---|---|
type | EpicGames_External_Credential_Type | Type of external login; identifies the authentication method to use. |
access_token | String | External token associated with the user logging in. |
display_name | String | The user's display name on the identity provider systems. |
Returns:
Triggers:
Key | Type | Description |
---|---|---|
type | String | The string "EpicGames_Connect_Login"
|
status | EpicGames_Result | The status code for the operation. EpicGames_Success indicates that the operation succeeded; other codes indicate errors |
status_message | String | Text representation of the status code |
identifier | Real | The asynchronous listener ID. |
LocalUserId | String | If the operation succeeded, this is the Product User ID of the local user who logged in. |
Example:
identifier = EpicGames_Connect_Login();
The code sample above saves the identifier that can be used inside a Social Async Event.
if (async_load[? "type"] == "EpicGames_Connect_Login")
if (async_load[? "identifier"] == identifier)
{
if (async_load[? "status"] == EpicGames_Success)
{
show_debug_message(async_load[? "type"] + " succeeded!");
}
else
{
show_debug_message(async_load[? "type"] + " failed: " + async_load[? "status_message"]);
}
}
The code above matches the response against the correct event type and logs the success of the task.
Epic Online Services Function: EOS_Connect_RemoveNotifyAuthExpiration
This function unregisters from receiving expiration notifications.
Syntax:
EpicGames_Connect_RemoveNotifyAuthExpiration(id)
Argument | Type | Description |
---|---|---|
id | Real | The handle representing the registered callback (returned by EpicGames_Connect_AddNotifyAuthExpiration) |
Returns:
N/A
Example:
AddNotifyAuthExpiration_id = EpicGames_Connect_AddNotifyAuthExpiration();
//...
//...Later
//...
EpicGames_Connect_RemoveNotifyAuthExpiration(AddNotifyAuthExpiration_id);
The code sample above enables the auth expiration notifications (EpicGames_Connect_AddNotifyAuthExpiration) and later disables them by referring to the previously generated handle.
Epic Online Services Function: EOS_Connect_RemoveNotifyLoginStatusChanged
This function unregisters from receiving user login status updates.
Syntax:
EpicGames_Connect_RemoveNotifyLoginStatusChanged(Id)
Argument | Type | Description |
---|---|---|
Id | Real | The handle representing the registered callback (returned by EpicGames_Connect_AddNotifyLoginStatusChanged) |
Returns:
N/A
Example:
NotifyLoginStatusChanged_id = EpicGames_Connect_AddNotifyLoginStatusChanged();
//...
//...Later
//...
EpicGames_Connect_RemoveNotifyLoginStatusChanged(NotifyLoginStatusChanged_id);
The code sample above enables the login status changed notifications (EpicGames_Connect_AddNotifyLoginStatusChanged) and later disables them by referring to the previously generated handle.
An external account information is represented by a struct and contains data about a single account.
The status member present in the struct can be represented by one of the following values:
-
EpicGames_Success
if the information is available and was correctly returned; -
EpicGames_InvalidParameters
(extension internal error, should never be returned); -
EpicGames_NotFound
if the achievement definition is not found; -
EpicGames_Invalid_ProductUserID
if any of the userid options are incorrect;
This struct is referenced by the following functions:
Member | Type | Description |
---|---|---|
status | EpicGames_Result | The result value of the task |
status_message | String | Text representation of the status code |
DisplayName | String | Display name, can be null if not set. |
userID | String | The Product User ID of the target user. |
AccountId | String | External account ID. May be set to an empty string if the AccountIdType of another user belongs to different account system than the local user's authenticated account. The availability of this field is dependent on account system specifics. |
AccountIdType | EpicGames_ExternalAccountType | The identity provider that owns the external account. |
LastLoginTime | Int64 | The POSIX timestamp for the time the user last logged in. |
A struct containg information about an ID token.
This struct is referenced by the following functions:
Member | Type | Description |
---|---|---|
status | EpicGames_Result | The status code for the operation. EpicGames_Success indicates that the operation succeeded; other codes indicate errors |
status_message | String | Text representation of the status code |
JsonWebToken | String | The ID token as a JSON Web Token (JWT) string. |
ProductUserId | String | The Product User ID described by the ID token. |
YoYoGames 2024