connect - YoYoGames/GMEXT-EpicOnlineServices GitHub Wiki

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.

Functions

These functions are provided for handling connectivity:

Structs

These are the structures used by this API:



Back To Top

eos_connect_add_notify_auth_expiration

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 eos_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:

eos_connect_add_notify_auth_expiration()



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String The string "eos_connect_add_notify_auth_expiration"
identifier Real The asynchronous listener ID

Example:

identifier = eos_connect_add_notify_auth_expiration();

The code sample above saves the identifier that can be used inside a Social Async Event.

if (async_load[? "type"] == "eos_connect_add_notify_auth_expiration")
{
    if (async_load[? "status"] == EOS_RESULT.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.




Back To Top

eos_connect_add_notify_login_status_changed

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:

eos_connect_add_notify_login_status_changed()



Returns:

Real


Triggers:

Social Async Event

Key Type Description
type String The string "eos_connect_add_notify_login_status_changed"
current_status EOS_LOGIN_STATUS The status at the time of the notification
previous_status EOS_LOGIN_STATUS The status prior to the change

Example:

identifier = eos_connect_add_notify_login_status_changed();

The code sample above save the identifier that can be used inside a Social Async Event.

if (async_load[? "type"] == "eos_connect_add_notify_login_status_changed")
if (async_load[? "identifier"] == identifier)
{
    if (async_load[? "status"] == EOS_RESULT.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.




Back To Top

eos_connect_copy_id_token

Epic Online Services Function: EOS_Connect_CopyIdToken

This function fetches an ID token for a Product User ID.


Syntax:

eos_connect_copy_id_token(user)
Argument Type Description
user String The local Product User ID whose ID token should be copied



Returns:

IdToken


Example:

var _struct = eos_connect_copy_id_token(user);
if(_struct.status = EOS_RESULT.SUCCESS)
{
    json_web_token = _struct.json_web_token;
}

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.




Back To Top

eos_connect_copy_product_user_info

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:

eos_connect_copy_product_user_info(user_id_target)
Argument Type Description
user_id_target String Product user ID to look for when copying external account info from the cache.



Returns:

ExternalAccountInfo


Example:

var _struct = eos_connect_copy_product_user_info(user_id_target);
if(_struct.status == EOS_RESULT.SUCCESS)
{
    // access the data here
}

The above code shows an example of how the function should be used.




Back To Top

eos_connect_create_user

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:

eos_connect_create_user()



Returns:

Real


Triggers:

Social Async Event

Key Type Description
type String The string "eos_connect_create_user"
status EOS_RESULT The status code for the operation. EOS_RESULT.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
local_user_id String If the operation succeeded, this is the Product User ID of the local user who was created

Example:

identifier = eos_connect_create_user();

The code sample above saves the identifier that can be used inside a Social Async Event.

if (async_load[? "type"] == "eos_connect_create_user")
if (async_load[? "identifier"] == identifier)
{
    if (async_load[? "status"] == EOS_RESULT.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.




Back To Top

eos_connect_get_login_status

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:

eos_connect_get_login_status(user)
Argument Type Description
user String The Product User ID of the user being queried



Returns:

Real


Example:

if(eos_connect_get_login_status(user) == EOS_LOGIN_STATUS.LOGGED_IN)
    show_debug_message(user + ": is logged in");
else
    show_debug_message(user + ": not logged in");

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.




Back To Top

eos_connect_login

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:

eos_connect_login(type, access_token, display_name)
Argument Type Description
type EOS_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:

Real


Triggers:

Social Async Event

Key Type Description
type String The string "eos_connect_login"
status EOS_RESULT The status code for the operation. EOS_RESULT.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
local_user_id String If the operation succeeded, this is the Product User ID of the local user who logged in.

Example:

identifier = eos_connect_login();

The code sample above saves the identifier that can be used inside a Social Async Event.

if (async_load[? "type"] == "eos_connect_login")
if (async_load[? "identifier"] == identifier)
{
    if (async_load[? "status"] == EOS_RESULT.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.




Back To Top

eos_connect_remove_notify_auth_expiration

Epic Online Services Function: EOS_Connect_RemoveNotifyAuthExpiration

This function unregisters from receiving expiration notifications.


Syntax:

eos_connect_remove_notify_auth_expiration(id)
Argument Type Description
id Real The handle representing the registered callback (returned by eos_connect_add_notify_auth_expiration)



Returns:

N/A


Example:

add_notify_auth_expiration_id = eos_connect_add_notify_auth_expiration();
//...
//...Later
//...
eos_connect_remove_notify_auth_expiration(add_notify_auth_expiration_id);

The code sample above enables the auth expiration notifications (eos_connect_add_notify_auth_expiration) and later disables them by referring to the previously generated handle.




Back To Top

eos_connect_remove_notify_login_status_changed

Epic Online Services Function: EOS_Connect_RemoveNotifyLoginStatusChanged

This function unregisters from receiving user login status updates.


Syntax:

eos_connect_remove_notify_login_status_changed(id)
Argument Type Description
id Real The handle representing the registered callback (returned by eos_connect_add_notify_login_status_changed)



Returns:

N/A


Example:

notify_login_status_changed_id = eos_connect_add_notify_login_status_changed();
//...
//...Later
//...
eos_connect_remove_notify_login_status_changed(notify_login_status_changed_id);

The code sample above enables the login status changed notifications (eos_connect_add_notify_login_status_changed) and later disables them by referring to the previously generated handle.




Back To Top

ExternalAccountInfo

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:

  • EOS_RESULT.SUCCESS if the information is available and was correctly returned;
  • EOS_RESULT.INVALID_PARAMETERS (extension internal error, should never be returned);
  • EOS_RESULT.NOT_FOUND if the achievement definition is not found;
  • EOS_RESULT.INVALID_PRODUCT_USER_ID if any of the user ID options are incorrect;

This struct is referenced by the following functions:


Member Type Description
status EOS_RESULT The result value of the task
status_message String Text representation of the status code
display_name String Display name, can not be present in the struct if not set
user_id String The Product User ID of the target user
account_id String External account ID. May be set to an empty string if the account_id_type 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.
account_id_type EOS_EXTERNAL_ACCOUNT_TYPE The identity provider that owns the external account
last_login_time Int64 The POSIX timestamp for the time the user last logged in


Back To Top

IdToken

A struct containing information about an ID token.

This struct is referenced by the following functions:


Member Type Description
status EOS_RESULT The status code for the operation. EOS_RESULT.SUCCESS indicates that the operation succeeded; other codes indicate errors
status_message String Text representation of the status code
json_web_token String The ID token as a JSON Web Token (JWT) string
product_user_id String The Product User ID described by the ID token

⚠️ **GitHub.com Fallback** ⚠️