Interface IServerAuthenticationService
The functions for the Server Authentication service.
Namespace: Unity.Services.Authentication.Server
Syntax
public interface IServerAuthenticationService
Properties
AccessToken
Returns the current access token, otherwise null.
Declaration
string AccessToken { get; }
Property Value
| Type | Description |
|---|---|
| String |
IsAuthorized
Validates that the state is authorized.
Declaration
bool IsAuthorized { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | Returns true if there is a valid non-expired token. |
State
The current state of the service
Declaration
ServerAuthenticationState State { get; }
Property Value
| Type | Description |
|---|---|
| ServerAuthenticationState |
Methods
ClearCredentials()
Clears the access token and authorization state.
Declaration
void ClearCredentials()
SignInFromServerAsync()
Retrieve a token to authorize server operations from a hosted server. Must be running on a multiplay server or with the server local proxy activated.
Declaration
Task SignInFromServerAsync()
Returns
| Type | Description |
|---|---|
| Task | Task for the operation |
Exceptions
| Type | Condition |
|---|---|
| ServerAuthenticationException | The task fails with the exception when the task cannot complete successfully. |
SignInWithServiceAccountAsync(String, String)
Trusted sign-in using service account credentials
Declaration
Task SignInWithServiceAccountAsync(string apiKeyIdentifier, string apiKeySecret)
Parameters
| Type | Name | Description |
|---|---|---|
| String | apiKeyIdentifier | The service account key id |
| String | apiKeySecret | The service account key secret |
Returns
| Type | Description |
|---|---|
| Task | Task for the operation |
Exceptions
| Type | Condition |
|---|---|
| ServerAuthenticationException | The task fails with the exception when the task cannot complete successfully. |
Events
AuthorizationFailed
Invoked when a sign-in attempt has failed. The reason for failure is passed as the parameter ServerAuthenticationException.
Declaration
event Action<ServerAuthenticationException> AuthorizationFailed
Event Type
| Type | Description |
|---|---|
| Action<ServerAuthenticationException> |
Authorized
Invoked when an authorization attempt has completed successfully.
Declaration
event Action Authorized
Event Type
| Type | Description |
|---|---|
| Action |
Expired
Invoked when an access token expires.
Declaration
event Action Expired
Event Type
| Type | Description |
|---|---|
| Action |