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

External Auth (C compatible)

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

modioGalaxyAuth

void modioGalaxyAuth(void* object, char* appdata, bool terms_agreed, void (*callback)(void* object, ModioResponse response))

API endpoint used: Authenticate via GOG Galaxy

C++ wrapper: External Auth#galaxyauth

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
object void* Context parameter.
appdata char* 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 void (*callback)(void* object, ModioResponse response) Function called once the process finished.

Callback parameters

Name Type Description
response ModioResponse ModioResponse object that contains the mod.io response status

Example

void onGalaxyAuth(void *object, ModioResponse response)
{
  if (response.code == 200)
  {
    // Successful Galaxy authentication
  }
}

[...]

modioGalaxyAuth(NULL, "GALAXY APPDATA HERE", terms_agreed, &onGalaxyAuth);

modioOculusAuth

void modioOculusAuth(void* object, char const* nonce, char const* oculus_user_id, char const* access_token, char const* email, u32 date_expires, bool terms_agreed, void (*callback)(void* object, ModioResponse response));

API endpoint used: Authenticate via Oculus

C++ wrapper: External Auth#oculusauth

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
object void* Context parameter.
nonce char const* The nonce provided by calling ovr_User_GetUserProof() from the Oculus SDK.
oculus_user_id char const* The user's Oculus id providing by calling ovr_GetLoggedInUserID() from the Oculus SDK.
access_token char const* 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 char const* 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 void (*callback)(void* object, ModioResponse response) Function called once the process finished.

Callback parameters

Name Type Description
response ModioResponse ModioResponse object that contains the mod.io response status

Example

void onOculusAuth(void *object, ModioResponse response)
{
  if (response.code == 200)
  {
    // Successful Oculus authentication
  }
}

[...]

modioOculusAuth(&wait, nonce, oculus_user_id, access_token, email, date_expires, terms_agreed, &onOculusAuth);

modioSteamAuth

void modioSteamAuth(void* object, unsigned char* rgubTicket, u32 cubTicket, bool terms_agreed, void (*callback)(void* object, ModioResponse response))

API endpoint used: Authenticate via Steam

C++ wrapper: External Auth#steamauth

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.

Function parameters

Name Type Description
object void* Context parameter.
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 void (*callback)(void* object, ModioResponse response) Function called once the process finished.

Callback parameters

Name Type Description
response ModioResponse ModioResponse object that contains the mod.io response status

Example

void onSteamAuth(void *object, ModioResponse response)
{
  if (response.code == 200)
  {
    // Successful Steam authentication
  }
}

[...]

modioSteamAuth(NULL, rgubTicket, cubTicket, terms_agreed, &onSteamAuth);

modioSteamAuthEncoded

void modioSteamAuthEncoded(void* object, char const* base64_ticket, bool terms_agreed, void (*callback)(void* object, ModioResponse response))

API endpoint used: Authenticate via Steam

C++ wrapper: External Auth#steamauthencoded

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
object void* Context parameter.
base64_ticket char const* 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 void (*callback)(void* object, ModioResponse response) Function called once the process finished.

Callback parameters

Name Type Description
response ModioResponse ModioResponse object that contains the mod.io response status

Example

void onSteamAuth(void *object, ModioResponse response)
{
  if (response.code == 200)
  {
    // Successful Steam authentication
  }
}

[...]

modioSteamAuthEncoded(NULL, base64_ticket, terms_agreed, &onSteamAuth);

modioLinkExternalAccount

void modioLinkExternalAccount(void* object, u32 service, char* service_id, char* email, void (*callback)(void* object, ModioResponse response))

API endpoint used: Link External Account

C++ wrapper: External Auth#linkexternalaccount

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
object void* Context parameter.
service u32 The ExternalService constant where the user's account originates.
service_id char* The external service user id.
email char* The e-mail address to link to the authenticated user's account.
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 void (*callback)(void* object, ModioResponse response) Function called once the process finished.

Callback parameters

Name Type Description
response ModioResponse ModioResponse object that contains the mod.io response status

Example

void onLinkExternalAccount(void *object, ModioResponse response)
{
  if (response.code == 200)
  {
    // Account linked successfully
  }
}

[...]

modioLinkExternalAccount(NULL, MODIO_SERVICE_STEAM, "76561198071708793", "john@doe.com", &onLinkExternalAccount);

Contents

Clone this wiki locally