Interface IPlayerAccountService
Represents the Player Account Service.
Namespace: Unity.Services.PlayerAccounts
Assembly: Unity.Services.PlayerAccounts.dll
Syntax
public interface IPlayerAccountService
Properties
AccessToken
Gets the access token that was obtained during sign-in.
Declaration
string AccessToken { get; }
Property Value
| Type | Description |
|---|---|
| string |
IdToken
Gets the ID token that was obtained during sign-in.
Declaration
string IdToken { get; }
Property Value
| Type | Description |
|---|---|
| string |
IdTokenClaims
Gets the claims from the ID token that was obtained during sign-in.
Declaration
IdToken IdTokenClaims { get; }
Property Value
| Type | Description |
|---|---|
| IdToken |
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 | Returns true if player is signed in, else false. |
Methods
RefreshTokenAsync()
Refreshes the current access token using the refresh token.
Declaration
Task RefreshTokenAsync()
Returns
| Type | Description |
|---|---|
| Task |
SignOut()
Signs out the current player and revokes the access token.
Declaration
void SignOut()
StartSignInAsync()
Starts the sign in flow by launching the system browser to sign in the current player.
Declaration
Task StartSignInAsync()
Returns
| Type | Description |
|---|---|
| Task |
Remarks
To be notified of the sign-in outcome, including the retrieval of tokens, the developer must subscribe to the SignedIn event.
Events
SignInFailed
Invoked when a sign-in attempt has failed. The reason for failure is passed as the parameter RequestFailedException
Declaration
event Action<RequestFailedException> SignInFailed
Event Type
| Type | Description |
|---|---|
| Action<RequestFailedException> |
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 |