Interface IAuthenticationService
The functions for Authentication service.
Namespace: Unity.Services.Authentication
Assembly: solution.dll
Syntax
public interface IAuthenticationService
Properties
Name | Description |
---|---|
AccessToken | Returns the current player's access token when they are signed in, otherwise null. |
IsAuthorized | Checks whether the player is still authorized. A player is authorized as long as his access token remains valid. |
IsExpired | Checks whether the player session is expired. |
IsSignedIn | Checks whether the player is signed in or not. A player can remain signed in but have an expired session. |
PlayerId | Returns the current player's ID. This value is cached between sessions. |
PlayerInfo | Returns the current player's info, including linked identities. |
PlayerName | Returns the current player's name. This value is cached between sessions. |
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. |
SessionTokenExists | Check if there is an existing session token stored for the current profile. |
Methods
Name | Description |
---|---|
AddUsernamePasswordAsync(string, string) | Sign up with a new Username/Password and add it to the current logged in user. |
ClearSessionToken() | Deletes the session token if it exists. |
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. |
DeleteAccountAsync() | Deletes the currently signed in player permanently. |
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. |
GetPlayerInfoAsync() | Returns the info of the logged in player, which includes the player's id, creation time and linked identities. |
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. |
GetSignInCodeInfoAsync(string) | Fetches detailed information about a given sign-in code, including its associated identifier and expiration details. |
LinkWithAppleAsync(string, LinkOptions) | Link the current player with the Apple account using Apple's ID token. |
LinkWithAppleGameCenterAsync(string, string, string, string, ulong, LinkOptions) | Link the current player with the AppleGameCenter account using AppleGameCenter's teamPlayerId. |
LinkWithFacebookAsync(string, LinkOptions) | Link the current player with the Facebook account using Facebook's access token. |
LinkWithGoogleAsync(string, LinkOptions) | Link the current player with the Google account using Google's ID token. |
LinkWithGooglePlayGamesAsync(string, LinkOptions) | Link the current player with the Google play games account using Google play games' authorization code. |
LinkWithOculusAsync(string, string, LinkOptions) | Link the current player with an Oculus account |
LinkWithOpenIdConnectAsync(string, string, LinkOptions) | Link the current player with a custom openID Connect id provider account. |
LinkWithSteamAsync(string, string, string, LinkOptions) | Link the current player with the Steam account using Steam's session ticket. |
LinkWithSteamAsync(string, string, LinkOptions) | Link the current player with the Steam account using Steam's session ticket. |
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. |
LinkWithUnityAsync(string, LinkOptions) | Link the current player with Unity account using Unity's access token |
ProcessAuthenticationTokens(string, string) | Process the accessToken issued by the Unity Authentication Service. Effectivelly 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. |
SignInAnonymouslyAsync(SignInOptions) | Signs in the current player anonymously. No credentials are required and the session is confined to the current device. |
SignInWithAppleAsync(string, SignInOptions) | Sign in using Apple's ID token. If no options are used, this will create an account if none exist. |
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. |
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. |
SignInWithFacebookAsync(string, SignInOptions) | Sign in using Facebook's access token. If no options are used, this will create an account if none exist. |
SignInWithGoogleAsync(string, SignInOptions) | Sign in using Google's ID token. If no options are used, this will create an account if none exist. |
SignInWithGooglePlayGamesAsync(string, SignInOptions) | Sign in using Google Play Games' authorization code. If no options are used, this will create an account if none exist. |
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 |
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. |
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. |
SignInWithSteamAsync(string, string, SignInOptions) | Sign in using Steam's session ticket. If no options are used, this will create an account if none exist. |
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. |
SignInWithUnityAsync(string, SignInOptions) | Sign in using Unity Player Login's access token |
SignInWithUsernamePasswordAsync(string, string) | Sign in using Username and Password credentials. |
SignOut(bool) | Sign out the current player. |
SignUpWithUsernamePasswordAsync(string, string) | Sign up using Username and Password credentials. |
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, |
UnlinkAppleAsync() | Unlinks the Apple account from the current player account. |
UnlinkAppleGameCenterAsync() | Unlinks the AppleGameCenter account from the current player account. |
UnlinkFacebookAsync() | Unlinks the Facebook account from the current player account. |
UnlinkGoogleAsync() | Unlinks the Google account from the current player account. |
UnlinkGooglePlayGamesAsync() | Unlinks the Google play games account from the current player account. |
UnlinkOculusAsync() | Unlinks the Oculus account from the current player account |
UnlinkOpenIdConnectAsync(string) | Unlinks the custom openID Connect id provider account from the current player account. |
UnlinkSteamAsync() | Unlinks the Steam account from the current player account. |
UnlinkUnityAsync() | Unlinks the Unity account from the current player account |
UpdatePasswordAsync(string, string) | Update Password credentials for username/password user. |
UpdatePlayerNameAsync(string) | Updates the player name of the logged in player. |
Events
Name | Description |
---|---|
Expired | Invoked when a session expires. |
SignInCodeExpired | Invoked when the sign-in code expires. |
SignInCodeReceived | Invoked when the SignInWithCodeAsync method successfully generates a SignInCode. |
SignInFailed | Invoked when a sign-in attempt has failed. The reason for failure is passed as the parameter RequestFailedException AuthenticationException. |
SignedIn | Invoked when a sign-in attempt has completed successfully. |
SignedOut | Invoked when a sign-out attempt has completed successfully. |