-
Notifications
You must be signed in to change notification settings - Fork 0
auth
This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
- modio_auth_terms
- modio_auth_steam
- modio_auth_xboxlive
- modio_auth_playstation
- modio_auth_nintendo_switch
- modio_auth_metaquest
- modio_auth_gog
- modio_auth_epicgames
- modio_auth_itchio
- modio_auth_google
- modio_auth_discord
- modio_auth_openid
- modio_auth_email
- modio_auth_email
- modio_auth_email_exchange
- modio_auth_logout
mod.io Endpoint: Terms
This function provides the text, links and buttons you can use to get a users agreement and consent prior to authenticating them in-game. A successful response returns a Terms struct.
See Terms for an example dialog and requirements for this function.
Syntax:
modio_auth_terms(_callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_callback_success | Function or Method | The function to execute when the request is successful. |
_callback_failed | Function or Method | The function to execute when the request failed. |
Returns:
mod.io Endpoint: Steam
This function requests an access token on behalf of a Steam user. To use this functionality you must add your game's encrypted app ticket key from Steamworks, to the Game Admin > Settings page of your game's profile on mod.io. A successful request will return an AccessToken struct.
⚠️ WARNINGIn order to use this authentication method you need to include the Steamworks extension in your project and call
steam_user_request_encrypted_app_ticket
to get a ticket. The ticket is then returned in theticket_data
key of the async_load ds_map.
ℹ️ NOTE
Steam is the only authentication endpoint that requires the token to be base64 encoded. All other endpoints' tokens should be provided as a UTF-8 character string.
Syntax:
modio_auth_steam(_appdata, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_appdata | String | The Steam user's Encrypted App Ticket provided by the Steamworks SDK, as a base64-encoded string. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address (optional but recommended to help users recover lost accounts). If supplied, and the respective user doesn't have an email registered for their account mod.io will send a confirmation email to confirm they have ownership of the specified email. * date_expires (Real) The Unix timestamp of the date in which the returned token will expire. The value cannot be higher than the default value, which is a common year (unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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_success | Function or Method | The function that is triggered when the request is successful. |
_callback_failed | Function or Method | The function that is triggered when the request failed. |
Returns:
mod.io Endpoint: Xbox Live
This function requests an access token on behalf of an Xbox Live user. A successful request will return an AccessToken struct.
ℹ️ NOTE
To use this endpoint you will need to set up some additional settings prior to being able to authenticate Xbox Live users. For these instructions you should contact mod.io.
Syntax:
modio_auth_xboxlive(_xbox_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_xbox_token | String | A valid Xbox Live token |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address (optional but recommended to help users recover lost accounts). If supplied, and when the respective user does not have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. This functionality is also available at a later time via the Link an Email endpoint. > ℹ️ NOTE > > If the user already has an email on record with mod.io, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value, which is a common year (unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you will need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: PlayStation™Network
This function requests an access token on behalf of a PlayStation Network (PSN) user. A successful request will return an AccessToken struct.
From the mod.io docs:
ℹ️ NOTE
To use this endpoint you will need to set up some additional settings prior to being able to authenticate PlayStation users. For these instructions please contact mod.io.
"PlayStation" and "DualSense" are registered trademarks or trademarks of Sony Interactive Entertainment Inc.
Syntax:
modio_auth_playstation(_auth_code, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_auth_code | String | The auth code returned from the PlayStation Network API. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The users email address. If supplied, and the respective user does not have an email registered for their account, it will send a confirmation email to confirm they have ownership of the specified email. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a common year (unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you will need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Nintendo Switch
This function requests an access token on behalf of a Nintendo Switch user. A successful request will return an AccessToken struct.
ℹ️ NOTE
To use this endpoint you will need to setup some additional settings prior to being able to authenticate Nintendo Switch users. For these instructions you should contact mod.io.
Syntax:
modio_auth_nintendo_switch(_id_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_id_token | String | The NSA ID supplied by the Nintendo Switch SDK. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a common year (Unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you will need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Meta Quest
This function requests an access token on behalf of a Meta Quest user. To use this functionality you must add your game's AppId and secret from the Meta Quest Dashboard, to the Game Admin > Settings page of your game's profile on mod.io. A successful request will return an AccessToken struct.
Syntax:
modio_auth_metaquest(_device, _nonce, _user_id, _access_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_device | String | The Meta Quest device being used for authentication. |
_nonce | String | The nonce provided by calling ovr_User_GetUserProof() from the Meta Quest SDK. |
_user_id | Real | The user's Meta Quest ID providing by calling ovr_GetLoggedInUserID() from the Meta Quest SDK. |
_access_token | String | The user's access token, providing by calling ovr_User_GetAccessToken() from the Meta Quest SDK. mod.io uses this access token on the first login only to obtain the user's alias and is not saved on the mod.io servers. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a common year (Unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you will need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: GOG Galaxy
This function requests an access token on behalf of a GOG Galaxy user. To use this functionality you must add your game's encrypted app ticket key from GOG Galaxy, to the Game Admin > Settings page of your game's profile on mod.io. A successful request will return an AccessToken struct.
Syntax:
modio_auth_gog(_appdata, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_appdata | String | The GOG Galaxy user's Encrypted App Ticket. You can get this using the GOG extension's GOG_User_GetEncryptedAppTicket function. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a common year (Unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you will need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
This function requests an access token on behalf of an Epic Games user. A successful request will return an AccessToken.
IMPORTANT
You can get an access token by first logging in the user using
EpicGames_Auth_Login
, followed byEpicGames_Auth_CopyUserAuthToken
.
Syntax:
modio_auth_epicgames(_access_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_access_token | String | The access token returned by the EpicGames_Auth_CopyUserAuthToken function of the Epic online Services extension. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, it will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a week (unix timestamp + 604800 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you'll need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: itch.io
This function requests an access token on behalf of an itch.io user via the itch.io desktop app. Due to the desktop application allowing multiple users to be logged in at once, if more than one user is logged in then the user at the top of that list on the itch.io login dialog will be the authenticating user. A successful request will return an AccessToken struct.
Syntax:
modio_auth_itchio(_itchio_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_itchio_token | String | The JWT Token provided by the itch.io desktop application to your game as the environment variable ITCHIO_API_KEY . You must set up your itch.io app manifest to include the API scope to force itch.io to set this variable. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a week (Unix timestamp + 604800 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you'll need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Google
This function requests an access token on behalf of a Google user. A successful request will return an AccessToken struct.
IMPORTANT
You can get an access token by calling the
GoogleSignIn_Show
function of the GoogleSignIn extension. The token is returned in the async_load'sidToken
key.
ℹ️ NOTE
To use this endpoint you will need to set up some additional settings prior to being able to authenticate Google users. For these instructions please contact mod.io.
Syntax:
modio_auth_google(_id_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_id_token | String | The id_token value returned from Google after you have authenticated a user via the Google OAuth2 flow. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a week (Unix timestamp + 604800 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you'll need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Discord
This function requests an access token on behalf of a Discord user. A successful request will return an AccessToken struct.
Syntax:
modio_auth_discord(_discord_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_discord_token | String | The access token of the user provided by Discord. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a week (Unix timestamp + 604800 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you'll need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: OpenID
This function requests an access token on behalf of an OpenID identity provider. To use this method of authentication, you must configure the OpenID config in your game's authentication admin page. A successful request will return an AccessToken struct.
Syntax:
modio_auth_openid(_id_token, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_id_token | String | The ID token issued by the configured identity provider. |
_optionals | Struct | A struct that can contain one or more of the following variables: * email (String) The user's email address. If supplied, and the respective user doesn't have an email registered for their account, mod.io will send a confirmation email to confirm they have ownership of the specified email. > ℹ️ NOTE > > If the user already has an email on record, this parameter will be ignored. This parameter should also be URL encoded before the request is sent. * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a week (Unix timestamp + 604800 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response.* terms_agreed (Boolean) 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.> ℹ️ NOTE > > If this is set to false and the user has not agreed to the latest mod.io Terms of Use and Privacy Policy, an error 403 Forbidden (error_ref 11074) will be returned and you'll need to collect the users agreement and retry with this value set to true to authenticate the user. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Email Exchange
This function requests a security code for a user, identified by their e-mail which can then be exchanged for an access token. A successful request will return a Message struct.
To use this functionality you must use your game's api_key from your game's profile on mod.io.
Syntax:
modio_auth_email(_email, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_email | String | An email address the user can access to retrieve the security code. This parameter should also be URL encoded before the request is sent. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Email Exchange
This function exchanges a security code issued from the Email Request endpoint for an access token.
To use this functionality you must use your game's api_key from your game's profile on mod.io and the same api_key must be used from the original request for a security code.
A successful request will return an AccessToken struct.
Syntax:
modio_auth_email_exchange(_security_code, _optionals, _callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_security_code | String | The alphanumeric security code. |
_optionals | Struct | A struct that can contain one or more of the following variables: * date_expires (Real) The Unix timestamp of the date on which the returned token will expire. The value cannot be higher than the default value which is a common year (unix timestamp + 31536000 seconds). Using a token after its expiry time has elapsed will result in a 401 Unauthorized response. |
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
mod.io Endpoint: Logout
This function logs out the user by revoking their current access token.
If this request successfully completes, you should remove any tokens/cookies/cached credentials linking to the now revoked access token so that the user is required to login again through your application.
Syntax:
modio_auth_logout(_callback_success, _callback_failed)
Argument | Type | Description |
---|---|---|
_callback_success | Function or Method | The function to trigger when the request is successful. |
_callback_failed | Function or Method | The function to trigger when the request failed. |
Returns:
GameMaker 2023