Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

External Auth

Markus Rännare edited this page Feb 11, 2021 · 7 revisions

External authentication flow

galaxyAuth

void Instance::galaxyAuth(const std::string &appdata, bool terms_agreed, const std::function<void(const modio::Response &)> &callback)

API endpoint used: Authenticate via GOG Galaxy

Request an access token on behalf of a GOG Galaxy user. To use this functionality you must supply your games encrypted app ticket key supplied by GOG Galaxy, in the Edit > Options page of your games profile on mod.io. Additionally you have to retrieve the appdata from the Galaxy SDK.

Function parameters

Name Type Description
appdata const std::string& The GOG Galaxy users Encrypted App Ticket provided by the GOG Galaxy SDK.
terms_agreed bool This MUST be set to false unless you have collected the users agreement prior to calling this endpoint in which case it can be set to true and will be recorded.
callback const std::function<void(const modio::Response&)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.galaxyAuth(appdata, terms_agreed, [&](const modio::Response &response)
{
  if (response.code == 200)
  {
    //Successful Galaxy authentication
  }
});

oculusAuth

void Instance::oculusAuth(const std::string &nonce, const std::string &oculus_user_id, const std::string &access_token, const std::string &email, u32 date_expires, bool terms_agreed, const std::function<void(const modio::Response &)> &callback);

API endpoint used: Authenticate via GOG Galaxy

Request an access token on behalf of an Oculus user. To use this functionality you must supply your games encrypted app ticket key supplied by GOG Galaxy, in the Edit > Options page of your games profile on mod.io. Additionally you have to retrieve the nonce, user id and token from the Oculus SDK.

Function parameters

Name Type Description
nonce const std::string& The nonce provided by calling ovr_User_GetUserProof() from the Oculus SDK.
oculus_user_id const std::string& The user's Oculus id providing by calling ovr_GetLoggedInUserID() from the Oculus SDK.
access_token const std::string& The user's access token, providing by calling ovr_User_GetAccessToken() from the Oculus SDK. mod.io uses this access token on the first login only to obtain the user's username and is not saved on our servers.
email const std::string& The users email address. This is recommended but optional.
date_expires u32 Unix timestamp of date in which the returned token will expire.
terms_agreed bool This MUST be set to false unless you have collected the users agreement prior to calling this endpoint in which case it can be set to true and will be recorded.
callback const std::function<void(const modio::Response&)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.oculusAuth(nonce, oculus_user_id, access_token, email, date_expires, terms_agreed, [&](const modio::Response &response) {
  if (response.code == 200)
  {
    //Successful Oculus authentication
  }
});

steamAuth

void Instance::steamAuth(const unsigned char* rgubTicket, u32 cubTicket, terms_agreed, const std::function<void(const modio::Response &)> &callback)

API endpoint used: Authenticate via Steam

Request an access token on behalf of a Steam user. To use this functionality you must supply your games encrypted app ticket key supplied by Steamworks, in the Edit > Options page of your games profile on mod.io. Additionally connect to the Steamworks SDK to retrieve an authentication ticket.

Function parameters

Name Type Description
rgubTicket const unsigned char* The Steam Encrypted App Ticket provided by the Steamworks SDK.
cubTicket u32 The Steam Encrypted App Ticket size provided by the Steamworks SDK.
terms_agreed bool This MUST be set to false unless you have collected the users agreement prior to calling this endpoint in which case it can be set to true and will be recorded.
callback const std::function<void(const modio::Response&)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.steamAuth(rgubTicket, cubTicket, terms_agreed, [&](const modio::Response &response)
{
  if (response.code == 200)
  {
    //Successful Steam authentication
  }
});

steamAuthEncoded

void Instance::steamAuth(const std::string &base64_token, bool terms_agreed, const std::function<void(const modio::Response &)> &callback)

API endpoint used: Authenticate via Steam

Request an access token on behalf of a Steam user. To use this functionality you must supply your games encrypted app ticket key supplied by Steamworks, in the Edit > Options page of your games profile on mod.io. Additionally connect to the Steamworks SDK to retrieve an authentication ticket.

Function parameters

Name Type Description
base64_token const unsigned char* The Steam Encrypted App Ticket provided by the Steamworks SDK and encrypted on base 64 format.
terms_agreed bool This MUST be set to false unless you have collected the users agreement prior to calling this endpoint in which case it can be set to true and will be recorded.
callback const std::function<void(const modio::Response&)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.steamAuth(base64_token, terms_agreed, [&](const modio::Response &response)
{
  if (response.code == 200)
  {
    //Successful Steam authentication
  }
});

linkExternalAccount

void Instance::linkExternalAccount(u32 service, const std::string &service_id, const std::string &email, const std::function<void(const modio::Response &)> &callback)

API endpoint used: Link External Account

Connect an external account (i.e. Steam and GOG documented above) with the authenticated user's e-mail address. When calling this endpoint you must provide authenticated user's ID of their external account. If we have a matching external account saved for that user, a Successful request will which means the user will have to check the supplied e-mail address to link the external account to the respective e-mail address.

Function parameters

Name Type Description
service u32 The ExternalService constant where the user's account originates.
service_id std::string The external service user id.
email std::string The e-mail address to link to the authenticated user's account.
callback const std::function<void(const modio::Response&)>& Function called once the process finished.

Callback parameters

Name Type Description
response const modio::Response& modio::Response object that contains the mod.io response status.

Example

modio_instance.linkExternalAccount(MODIO_SERVICE_STEAM, "76561198071708793", "[email protected]", [&](const modio::Response &response)
{
  if (response.code == 200)
  {
    //Account linked successfully
  }
});

Contents

Clone this wiki locally