v2.6.1
Latest
2019.4+

Interface IAuthenticationService

The functions for Authentication service.

Namespace: Unity.Services.Authentication
Syntax
public interface IAuthenticationService

Properties

AccessToken

Returns the current player's access token when they are signed in, otherwise null.

Declaration
string AccessToken { get; }
Property Value
TypeDescription
String

IsAuthorized

Checks whether the player is still authorized. A player is authorized as long as his access token remains valid.

Declaration
bool IsAuthorized { get; }
Property Value
TypeDescription
Boolean

Returns true if player is authorized, else false.

IsExpired

Checks whether the player session is expired.

Declaration
bool IsExpired { get; }
Property Value
TypeDescription
Boolean

Returns true if player's session expired.

IsSignedIn

Checks whether the player is signed in or not. A player can remain signed in but have an expired session.

Declaration
bool IsSignedIn { get; }
Property Value
TypeDescription
Boolean

Returns true if player is signed in, else false.

PlayerId

Returns the current player's ID. This value is cached between sessions.

Declaration
string PlayerId { get; }
Property Value
TypeDescription
String

PlayerInfo

Returns the current player's info, including linked identities.

Declaration
PlayerInfo PlayerInfo { get; }
Property Value
TypeDescription
PlayerInfo

PlayerName

Returns the current player's name. This value is cached between sessions.

Declaration
string PlayerName { get; }
Property Value
TypeDescription
String

Profile

The profile isolates the values saved to the PlayerPrefs. You can use profiles to sign in to multiple accounts on a single device. Use the SwitchProfile(String) method to change this value.

Declaration
string Profile { get; }
Property Value
TypeDescription
String

SessionTokenExists

Check if there is an existing session token stored for the current profile.

Declaration
bool SessionTokenExists { get; }
Property Value
TypeDescription
Boolean

Methods

ClearSessionToken()

Deletes the session token if it exists.

Declaration
void ClearSessionToken()
Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

DeleteAccountAsync()

Deletes the currently signed in player permanently.

Declaration
Task DeleteAccountAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

GetPlayerInfoAsync()

Returns the info of the logged in player, which includes the player's id, creation time and linked identities.

Declaration
Task<PlayerInfo> GetPlayerInfoAsync()
Returns
TypeDescription
Task<PlayerInfo>

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

GetPlayerNameAsync()

Returns the name of the logged in player if it has been set. If no name has been set, this will return null. This will also cache the name locally.

Declaration
Task<string> GetPlayerNameAsync()
Returns
TypeDescription
Task<String>

Task for the operation with the resulting player name

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithAppleAsync(String, LinkOptions)

Link the current player with the Apple account using Apple's ID token.

Declaration
Task LinkWithAppleAsync(string idToken, LinkOptions options = null)
Parameters
TypeNameDescription
StringidToken

Apple's ID token

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithAppleGameCenterAsync(String, String, String, String, UInt64, LinkOptions)

Link the current player with the AppleGameCenter account using AppleGameCenter's teamPlayerId.

Declaration
Task LinkWithAppleGameCenterAsync(string signature, string teamPlayerId, string publicKeyURL, string salt, ulong timestamp, LinkOptions options = null)
Parameters
TypeNameDescription
Stringsignature

AppleGameCenter's signature

StringteamPlayerId

AppleGameCenter's teamPlayerId

StringpublicKeyURL

AppleGameCenter's publicKeyURL

Stringsalt

AppleGameCenter's salt

UInt64timestamp

AppleGameCenter's timestamp

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithFacebookAsync(String, LinkOptions)

Link the current player with the Facebook account using Facebook's access token.

Declaration
Task LinkWithFacebookAsync(string accessToken, LinkOptions options = null)
Parameters
TypeNameDescription
StringaccessToken

Facebook's access token

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithGoogleAsync(String, LinkOptions)

Link the current player with the Google account using Google's ID token.

Declaration
Task LinkWithGoogleAsync(string idToken, LinkOptions options = null)
Parameters
TypeNameDescription
StringidToken

Google's ID token

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithGooglePlayGamesAsync(String, LinkOptions)

Link the current player with the Google play games account using Google play games' authorization code.

Declaration
Task LinkWithGooglePlayGamesAsync(string authCode, LinkOptions options = null)
Parameters
TypeNameDescription
StringauthCode

Google play games' authorization code

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithOculusAsync(String, String, LinkOptions)

Link the current player with an Oculus account

Declaration
Task LinkWithOculusAsync(string nonce, string userId, LinkOptions options = null)
Parameters
TypeNameDescription
Stringnonce

Client provided nonce key used by the server to verify that the provided Oculus userId is valid

StringuserId

Oculus account userId

LinkOptionsoptions

Options for th operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithOpenIdConnectAsync(String, String, LinkOptions)

Link the current player with a custom openID Connect id provider account.

Declaration
Task LinkWithOpenIdConnectAsync(string idProviderName, string idToken, LinkOptions options = null)
Parameters
TypeNameDescription
StringidProviderName

the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters

StringidToken

Id Token for the custom id provider

LinkOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithSteamAsync(String, LinkOptions)

Link the current player with the Steam account using Steam's session ticket.

Declaration
Task LinkWithSteamAsync(string sessionTicket, LinkOptions options = null)
Parameters
TypeNameDescription
StringsessionTicket

Steam's session ticket

LinkOptionsoptions

Options for the link operations.

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

LinkWithUnityAsync(String, LinkOptions)

Link the current player with Unity account using Unity's access token

Declaration
Task LinkWithUnityAsync(string token, LinkOptions options = null)
Parameters
TypeNameDescription
Stringtoken

Unity's access token

LinkOptionsoptions

Options for the link operations

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode AccountAlreadyLinked if the player tries to link a social account while the social account is already linked with another player.
  • Throws with ErrorCode InvalidParameters if parameter is empty or invalid.
  • Throws with ErrorCode ClientInvalidUserState if the player is not authorized to perform this operation.
  • Throws with ErrorCode AccountLinkLimitExceeded if the player has already reached the limit of links for this provider type.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInAnonymouslyAsync(SignInOptions)

Signs in the current player anonymously. No credentials are required and the session is confined to the current device.

Declaration
Task SignInAnonymouslyAsync(SignInOptions options = null)
Parameters
TypeNameDescription
SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Remarks

If a player has signed in previously with a session token stored on the device, they are signed back in regardless of if they're an anonymous player or not.

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

  • Throws with ErrorCode ClientInvalidUserState if the player has already signed in or a sign-in operation is in progress.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithAppleAsync(String, SignInOptions)

Sign in using Apple's ID token. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithAppleAsync(string idToken, SignInOptions options = null)
Parameters
TypeNameDescription
StringidToken

Apple's ID token

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithAppleGameCenterAsync(String, String, String, String, UInt64, SignInOptions)

Sign in using AppleGameCenter's teamPlayerId. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithAppleGameCenterAsync(string signature, string teamPlayerId, string publicKeyURL, string salt, ulong timestamp, SignInOptions options = null)
Parameters
TypeNameDescription
Stringsignature

AppleGameCenter's signature

StringteamPlayerId

AppleGameCenter's teamPlayerId

StringpublicKeyURL

AppleGameCenter's publicKeyURL

Stringsalt

AppleGameCenter's salt

UInt64timestamp

AppleGameCenter's timestamp

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithFacebookAsync(String, SignInOptions)

Sign in using Facebook's access token. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithFacebookAsync(string accessToken, SignInOptions options = null)
Parameters
TypeNameDescription
StringaccessToken

Facebook's access token

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithGoogleAsync(String, SignInOptions)

Sign in using Google's ID token. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithGoogleAsync(string idToken, SignInOptions options = null)
Parameters
TypeNameDescription
StringidToken

Google's ID token

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithGooglePlayGamesAsync(String, SignInOptions)

Sign in using Google Play Games' authorization code. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithGooglePlayGamesAsync(string authCode, SignInOptions options = null)
Parameters
TypeNameDescription
StringauthCode

Google Play Games' authorization code

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithOculusAsync(String, String, SignInOptions)

Sign in using an Oculus account userId and nonce key If no options are used, this will create an account if none exists

Declaration
Task SignInWithOculusAsync(string nonce, string userId, SignInOptions options = null)
Parameters
TypeNameDescription
Stringnonce

Client provided nonce key used by the server to verify that the provided Oculus userId is valid

StringuserId

Oculus account userId

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithOpenIdConnectAsync(String, String, SignInOptions)

Sign in using a custom openID Connect id provider account. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithOpenIdConnectAsync(string idProviderName, string idToken, SignInOptions options = null)
Parameters
TypeNameDescription
StringidProviderName

the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters

StringidToken

Id Token for the custom id provider

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithSteamAsync(String, SignInOptions)

Sign in using Steam's session ticket. If no options are used, this will create an account if none exist.

Declaration
Task SignInWithSteamAsync(string sessionTicket, SignInOptions options = null)
Parameters
TypeNameDescription
StringsessionTicket

Steam's session ticket

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignInWithUnityAsync(String, SignInOptions)

Sign in using Unity Player Login's access token

Declaration
Task SignInWithUnityAsync(string token, SignInOptions options = null)
Parameters
TypeNameDescription
Stringtoken

Unity Player Login's access token

SignInOptionsoptions

Options for the operation

Returns
TypeDescription
Task

Task for the async operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if the server side returned an invalid access token.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

SignOut(Boolean)

Sign out the current player.

Declaration
void SignOut(bool clearCredentials = false)
Parameters
TypeNameDescription
BooleanclearCredentials

Option to clear the session token that enables logging in to the same account

SwitchProfile(String)

Switch the current profile. You can use profiles to sign in to multiple accounts on a single device. A profile isolates the values saved to the PlayerPrefs. The profile may only contain alphanumeric values, -, _, and must be no longer than 30 characters. The player must be signed out for this operation to succeed.

Declaration
void SwitchProfile(string profile)
Parameters
TypeNameDescription
Stringprofile

The profile to switch to.

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

UnlinkAppleAsync()

Unlinks the Apple account from the current player account.

Declaration
Task UnlinkAppleAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkAppleGameCenterAsync()

Unlinks the AppleGameCenter account from the current player account.

Declaration
Task UnlinkAppleGameCenterAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkFacebookAsync()

Unlinks the Facebook account from the current player account.

Declaration
Task UnlinkFacebookAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkGoogleAsync()

Unlinks the Google account from the current player account.

Declaration
Task UnlinkGoogleAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkGooglePlayGamesAsync()

Unlinks the Google play games account from the current player account.

Declaration
Task UnlinkGooglePlayGamesAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkOculusAsync()

Unlinks the Oculus account from the current player account

Declaration
Task UnlinkOculusAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkOpenIdConnectAsync(String)

Unlinks the custom openID Connect id provider account from the current player account.

Declaration
Task UnlinkOpenIdConnectAsync(string idProviderName)
Parameters
TypeNameDescription
StringidProviderName

the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters

Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkSteamAsync()

Unlinks the Steam account from the current player account.

Declaration
Task UnlinkSteamAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UnlinkUnityAsync()

Unlinks the Unity account from the current player account

Declaration
Task UnlinkUnityAsync()
Returns
TypeDescription
Task

Task for the operation

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode InvalidToken if access token is invalid/expired. The access token is refreshed before it expires. This may happen if the refresh fails, or the app is unpaused with an expired access token while the refresh hasn't finished.
  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

UpdatePlayerNameAsync(String)

Updates the player name of the logged in player.

Declaration
Task<string> UpdatePlayerNameAsync(string name)
Parameters
TypeNameDescription
Stringname

The new name for the player. It must not contain spaces.

Returns
TypeDescription
Task<String>

Task for the operation with the resulting player name

Exceptions
TypeCondition
AuthenticationException

The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.

RequestFailedException

The task fails with the exception when the task cannot complete successfully.

  • Throws with ErrorCode TransportError if the API call failed due to network error. Check Unity logs for more debugging information.
  • Throws with ErrorCode Unknown if the API call failed due to unexpected response from the server. Check Unity logs for more debugging information.

Events

Expired

Invoked when a session expires.

Declaration
event Action Expired
Event Type
TypeDescription
Action

SignedIn

Invoked when a sign-in attempt has completed successfully.

Declaration
event Action SignedIn
Event Type
TypeDescription
Action

SignedOut

Invoked when a sign-out attempt has completed successfully.

Declaration
event Action SignedOut
Event Type
TypeDescription
Action

SignInFailed

Invoked when a sign-in attempt has failed. The reason for failure is passed as the parameter RequestFailedException AuthenticationException.

Declaration
event Action<RequestFailedException> SignInFailed
Event Type
TypeDescription
Action<RequestFailedException>