Interface IAuthenticationService
The functions for Authentication service.
Namespace: Unity.Services.Authentication
Assembly: Unity.Services.Authentication.dll
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
Type | Description |
---|---|
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
Type | Description |
---|---|
bool |
IsExpired
Checks whether the player session is expired.
Declaration
bool IsExpired { get; }
Property Value
Type | Description |
---|---|
bool |
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
Type | Description |
---|---|
bool |
LastNotificationDate
The date the last notification for the player was created or null if there are no notifications
Declaration
string LastNotificationDate { get; }
Property Value
Type | Description |
---|---|
string |
Notifications
Returns player's notifications after GetNotificationsAsync is called successfully.
Declaration
List<Notification> Notifications { get; }
Property Value
Type | Description |
---|---|
List<Notification> |
PlayerId
Returns the current player's ID. This value is cached between sessions.
Declaration
string PlayerId { get; }
Property Value
Type | Description |
---|---|
string |
PlayerInfo
Returns the current player's info, including linked identities.
Declaration
PlayerInfo PlayerInfo { get; }
Property Value
Type | Description |
---|---|
Player |
PlayerName
Returns the current player's name. This value is cached between sessions.
Declaration
string PlayerName { get; }
Property Value
Type | Description |
---|---|
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 Switch
Declaration
string Profile { get; }
Property Value
Type | Description |
---|---|
string |
SessionTokenExists
Check if there is an existing session token stored for the current profile.
Declaration
bool SessionTokenExists { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
AddUsernamePasswordAsync(string, string)
Sign up with a new Username/Password and add it to the current logged in user.
Declaration
Task AddUsernamePasswordAsync(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username of the player. Note that it must be unique per project and contains 3-20 characters of alphanumeric and/or these special characters [. - @ _]. |
string | password | Password of the player. Note that it must contain 8-30 characters with at least 1 upper case, 1 lower case, 1 number, and 1 special character. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
ClearSessionToken()
Deletes the session token if it exists.
Declaration
void ClearSessionToken()
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
ConfirmCodeAsync(string, string, string)
Sends a request to check the status of the provided sign-in code, such as if it's been confirmed by an authenticated user or is still pending. "Confirming" the sign-in code means the server has recognized and accepted the code as valid.
Declaration
Task ConfirmCodeAsync(string code, string idProvider = null, string externalToken = null)
Parameters
Type | Name | Description |
---|---|---|
string | code | The sign-in code to be confirmed. |
string | idProvider | The ID provider (optional). |
string | externalToken | The external token (optional). |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. If the operation succeeds, the task will complete successfully (indicating a successful response from the server). Otherwise, exceptions can be thrown as described below. |
Exceptions
Type | Condition |
---|---|
Authentication |
Thrown when the code is null or empty. |
Authentication |
Thrown when the current authentication state is invalid for this operation. |
Request |
Thrown when there's an issue with the network request. |
DeleteAccountAsync()
Deletes the currently signed in player permanently.
Declaration
Task DeleteAccountAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
GenerateSignInCodeAsync(string)
Asynchronously generates a sign-in code that can be used to sign in. This method should be called before attempting to sign in using the sign-in code.
Declaration
Task<SignInCodeInfo> GenerateSignInCodeAsync(string identifier = null)
Parameters
Type | Name | Description |
---|---|---|
string | identifier | An optional identifier. If provided, it may influence the generated sign-in code or be used for additional checks. |
Returns
Type | Description |
---|---|
Task<Sign |
A Task representing the asynchronous generation operation. The task result contains the generated Sign
|
Exceptions
Type | Condition |
---|---|
Authentication |
Thrown when the current authentication state is invalid for this operation. |
GetNotificationsAsync()
Retrieves the Notifications that were created for the signed in player
Declaration
Task<List<Notification>> GetNotificationsAsync()
Returns
Type | Description |
---|---|
Task<List<Notification>> | A Task representing the asynchronous operation. The task result contains the list of Notification. |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
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
Type | Description |
---|---|
Task<Player |
Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
GetPlayerNameAsync(bool)
Returns the name of the logged in player if it has been set. If no name has been set, this will return null if autoGenerate is set to false. This will also cache the name locally.
Declaration
Task<string> GetPlayerNameAsync(bool autoGenerate = true)
Parameters
Type | Name | Description |
---|---|---|
bool | autoGenerate | Option auto generate a player name if none already exist. Defaults to true |
Returns
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
GetSignInCodeInfoAsync(string)
Fetches detailed information about a given sign-in code, including its associated identifier and expiration details.
Declaration
Task<SignInCodeInfo> GetSignInCodeInfoAsync(string code)
Parameters
Type | Name | Description |
---|---|---|
string | code | The sign-in code to fetch information for. |
Returns
Type | Description |
---|---|
Task<Sign |
The identifier associated with the provided code. |
Exceptions
Type | Condition |
---|---|
Authentication |
Thrown when the code is null or empty. |
Authentication |
Thrown when the current authentication state is invalid for this operation. |
Request |
Thrown when there's an issue with the network request. |
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
Type | Name | Description |
---|---|---|
string | idToken | Apple's ID token |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
LinkWithAppleGameCenterAsync(string, string, string, string, ulong, 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
Type | Name | Description |
---|---|---|
string | signature | AppleGameCenter's signature |
string | teamPlayerId | AppleGameCenter's teamPlayerId |
string | publicKeyURL | AppleGameCenter's publicKeyURL |
string | salt | AppleGameCenter's salt |
ulong | timestamp | AppleGameCenter's timestamp |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | accessToken | Facebook's access token |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | idToken | Google's ID token |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | authCode | Google play games' authorization code |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
LinkWithOculusAsync(string, string, LinkOptions)
Link the current player with an Oculus account
Declaration
Task LinkWithOculusAsync(string nonce, string userId, LinkOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | nonce | Client provided nonce key used by the server to verify that the provided Oculus userId is valid |
string | userId | Oculus account userId |
Link |
options | Options for th operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | idProviderName | the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters |
string | idToken | Id Token for the custom id provider |
Link |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
LinkWithSteamAsync(string, string, string, LinkOptions)
Link the current player with the Steam account using Steam's session ticket.
Declaration
Task LinkWithSteamAsync(string sessionTicket, string identity, string appId, LinkOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
string | identity | The identity of the calling service |
string | appId | App Id that was used to generate the ticket. Only required for additional app ids (e.g.: PlayTest, Demo, etc) |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
LinkWithSteamAsync(string, string, LinkOptions)
Link the current player with the Steam account using Steam's session ticket.
Declaration
Task LinkWithSteamAsync(string sessionTicket, string identity, LinkOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
string | identity | The identity of the calling service |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
LinkWithSteamAsync(string, LinkOptions)
Link the current player with the Steam account using Steam's session ticket. This method is deprecated and may be removed in future versions.
Declaration
[Obsolete("This method is deprecated as of version 2.7.1. Please use the LinkWithSteamAsync method with the 'identity' parameter for better security.")]
Task LinkWithSteamAsync(string sessionTicket, LinkOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
Link |
options | Options for the link operations. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
LinkWithUnityAsync(string, LinkOptions)
Link the current player with Unity account using Unity's access token
Declaration
Task LinkWithUnityAsync(string token, LinkOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | token | Unity's access token |
Link |
options | Options for the link operations |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
ProcessAuthenticationTokens(string, string)
Process the accessToken issued by the Unity Authentication Service. Effectively setting the access token for other UGS services to use and extracting the playerId. If the session token is set the SDK will also process it and refresh the token at the expected intervals.
Declaration
void ProcessAuthenticationTokens(string accessToken, string sessionToken = null)
Parameters
Type | Name | Description |
---|---|---|
string | accessToken | Unity Player Authentication accessToken used to access other UGS services |
string | sessionToken | sessionToken used to refresh the accessToken, if null the game server needs to refresh the accessToken on its own and call this method again |
Exceptions
Type | Condition |
---|---|
Authentication |
Thrown when the accessToken fails to parse. |
Request |
Thrown when the current authentication state is invalid for this operation. |
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
Type | Name | Description |
---|---|---|
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
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
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | idToken | Apple's ID token |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithAppleGameCenterAsync(string, string, string, string, ulong, 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
Type | Name | Description |
---|---|---|
string | signature | AppleGameCenter's signature |
string | teamPlayerId | AppleGameCenter's teamPlayerId |
string | publicKeyURL | AppleGameCenter's publicKeyURL |
string | salt | AppleGameCenter's salt |
ulong | timestamp | AppleGameCenter's timestamp |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithCodeAsync(bool, CancellationToken)
Asynchronously attempts to sign in using the previously generated sign-in code. This method can optionally poll the server for sign-in confirmation.
Declaration
Task SignInWithCodeAsync(bool usePolling = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | usePolling | If set to true, the method will continuously poll the server to check if the code has been confirmed, until either the device signs in successfully, the code expires, or the CancellationToken is triggered. False by default. |
Cancellation |
cancellationToken | A token used to cancel the ongoing operation, especially useful when polling is enabled. |
Returns
Exceptions
Type | Condition |
---|---|
Authentication |
Thrown when the current authentication state is invalid for this operation. |
Request |
Thrown when there's an issue with the network request. |
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
Type | Name | Description |
---|---|---|
string | accessToken | Facebook's access token |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | idToken | Google's ID token |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | authCode | Google Play Games' authorization code |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | nonce | Client provided nonce key used by the server to verify that the provided Oculus userId is valid |
string | userId | Oculus account userId |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | idProviderName | the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters |
string | idToken | Id Token for the custom id provider |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithSteamAsync(string, string, 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, string identity, string appId, SignInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
string | identity | The identity of the calling service |
string | appId | App Id that was used to generate the ticket. Only required for additional app ids (e.g.: PlayTest, Demo, etc) |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithSteamAsync(string, 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, string identity, SignInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
string | identity | The identity of the calling service |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithSteamAsync(string, SignInOptions)
Sign in using Steam's session ticket. If no options are used, this will create an account if none exist. This method is deprecated and may be removed in future versions.
Declaration
[Obsolete("This method is deprecated as of version 2.7.1. Please use the SignInWithSteamAsync method with the 'identity' parameter for better security.")]
Task SignInWithSteamAsync(string sessionTicket, SignInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sessionTicket | Steam's session ticket |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the operation |
SignInWithUnityAsync(string, SignInOptions)
Sign in using Unity Player Login's access token
Declaration
Task SignInWithUnityAsync(string token, SignInOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
string | token | Unity Player Login's access token |
Sign |
options | Options for the operation |
Returns
Type | Description |
---|---|
Task | Task for the async operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignInWithUsernamePasswordAsync(string, string)
Sign in using Username and Password credentials.
Declaration
Task SignInWithUsernamePasswordAsync(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username of the player. Note that it must be unique per project and contains 3-20 characters of alphanumeric and/or these special characters [. - @ _]. |
string | password | Password of the player. Note that it must contain 8-30 characters with at least 1 upper case, 1 lower case, 1 number, and 1 special character. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
SignOut(bool)
Sign out the current player.
Declaration
void SignOut(bool clearCredentials = false)
Parameters
Type | Name | Description |
---|---|---|
bool | clearCredentials | Option to clear the session token that enables logging in to the same account |
SignUpWithUsernamePasswordAsync(string, string)
Sign up using Username and Password credentials.
Declaration
Task SignUpWithUsernamePasswordAsync(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username of the player. Note that it must be unique per project and contains 3-20 characters of alphanumeric and/or these special characters [. - @ _]. |
string | password | Password of the player. Note that it must contain 8-30 characters with at least 1 upper case, 1 lower case, 1 number, and 1 special character. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
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
Type | Name | Description |
---|---|---|
string | profile | The profile to switch to. |
Exceptions
Type | Condition |
---|---|
Authentication |
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
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkAppleGameCenterAsync()
Unlinks the AppleGameCenter account from the current player account.
Declaration
Task UnlinkAppleGameCenterAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkFacebookAsync()
Unlinks the Facebook account from the current player account.
Declaration
Task UnlinkFacebookAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkGoogleAsync()
Unlinks the Google account from the current player account.
Declaration
Task UnlinkGoogleAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkGooglePlayGamesAsync()
Unlinks the Google play games account from the current player account.
Declaration
Task UnlinkGooglePlayGamesAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkOculusAsync()
Unlinks the Oculus account from the current player account
Declaration
Task UnlinkOculusAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkOpenIdConnectAsync(string)
Unlinks the custom openID Connect id provider account from the current player account.
Declaration
Task UnlinkOpenIdConnectAsync(string idProviderName)
Parameters
Type | Name | Description |
---|---|---|
string | idProviderName | the name of the id provider created. Note that it must start with "oidc-" and have between 1 and 20 characters |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkSteamAsync()
Unlinks the Steam account from the current player account.
Declaration
Task UnlinkSteamAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UnlinkUnityAsync()
Unlinks the Unity account from the current player account
Declaration
Task UnlinkUnityAsync()
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UpdatePasswordAsync(string, string)
Update Password credentials for username/password user.
Declaration
Task UpdatePasswordAsync(string currentPassword, string newPassword)
Parameters
Type | Name | Description |
---|---|---|
string | currentPassword | Current password of the player. Note that it must contain 8-30 characters with at least 1 upper case, 1 lower case, 1 number, and 1 special character. |
string | newPassword | New password of the player. Note that it must contain 8-30 characters with at least 1 upper case, 1 lower case, 1 number, and 1 special character. |
Returns
Type | Description |
---|---|
Task | Task for the operation |
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
UpdatePlayerNameAsync(string)
Updates the player name of the logged in player.
Declaration
Task<string> UpdatePlayerNameAsync(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The new name for the player. It must not contain spaces. |
Returns
Exceptions
Type | Condition |
---|---|
Authentication |
The task fails with the exception when the task cannot complete successfully due to Authentication specific errors.
|
Request |
The task fails with the exception when the task cannot complete successfully.
|
Events
Expired
Invoked when a session expires.
Declaration
event Action Expired
Event Type
Type | Description |
---|---|
Action |
SignInCodeExpired
Invoked when the sign-in code expires.
Declaration
event Action SignInCodeExpired
Event Type
Type | Description |
---|---|
Action |
SignInCodeReceived
Invoked when the SignInWithCodeAsync method successfully generates a SignInCode.
Declaration
event Action<SignInCodeInfo> SignInCodeReceived
Event Type
Type | Description |
---|---|
Action<Sign |
SignInFailed
Invoked when a sign-in attempt has failed. The reason for failure is passed as the parameter
Unity.
Declaration
event Action<RequestFailedException> SignInFailed
Event Type
Type | Description |
---|---|
Action<Request |
SignedIn
Invoked when a sign-in attempt has completed successfully.
Declaration
event Action SignedIn
Event Type
Type | Description |
---|---|
Action |
SignedOut
Invoked when a sign-out attempt has completed successfully.
Declaration
event Action SignedOut
Event Type
Type | Description |
---|---|
Action |