Class PlayerAuthenticationApi
Represents a collection of functions to interact with the API endpoints
Inherited Members
Namespace: Unity.Services.Apis.PlayerAuthentication
Assembly: Unity.Services.Apis.dll
Syntax
public class PlayerAuthenticationApi : IPlayerAuthenticationApi, IApiAccessor
Constructors
PlayerAuthenticationApi(IApiClient)
Initializes a new instance of the Player
Declaration
public PlayerAuthenticationApi(IApiClient apiClient)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
PlayerAuthenticationApi(IApiClient, IApiConfiguration)
Initializes a new instance of the Player
Declaration
public PlayerAuthenticationApi(IApiClient apiClient, IApiConfiguration apiConfiguration)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
IApi |
apiConfiguration | The configuration object. |
Properties
Client
The client for accessing this underlying API asynchronously.
Declaration
public IApiClient Client { get; }
Property Value
Type | Description |
---|---|
IApi |
Configuration
Gets the configuration object
Declaration
public IApiConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IApi |
An instance of the Configuration |
Methods
CodeConfirmation(string, string, string, CodeLinkConfirmationRequest, CancellationToken)
Code Confirmation Allow a user to sign in to this account using this code
Declaration
public ApiOperation CodeConfirmation(string projectId, string unityEnvironment = null, string authorization = null, CodeLinkConfirmationRequest codeLinkConfirmationRequest = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Code |
codeLinkConfirmationRequest | Code confirmation request. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
DeletePlayer(string, string, string, CancellationToken)
Delete Player Delete the player.
Declaration
public ApiOperation DeletePlayer(string playerId, string projectId, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | playerId | This is the player id. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
GenerateCode(string, string, GenerateCodeRequest, CancellationToken)
Generate Code Generates a sign in code for an unauthenticated device.
Declaration
public ApiOperation<GenerateCodeResponse> GenerateCode(string projectId, string unityEnvironment = null, GenerateCodeRequest generateCodeRequest = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Generate |
generateCodeRequest | Generate Code Request Body (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
GetBasePath()
Gets the base path of the API client.
Declaration
public string GetBasePath()
Returns
Type | Description |
---|---|
string | The base path |
GetCodeInfo(string, CodeLinkInfoRequest, string, CancellationToken)
Get Code Info Get code information including the identifier and expiration.
Declaration
public ApiOperation<CodeLinkInfoResponse> GetCodeInfo(string projectId, CodeLinkInfoRequest codeLinkInfoRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Code |
codeLinkInfoRequest | Code Link Request for Sign In |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
GetJSONWebKeySet(CancellationToken)
Get JWKS Get the JSON Web Key Set for validating authentication tokens.
Declaration
public ApiOperation<JSONWebKeySet> GetJSONWebKeySet(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
GetPlayer(string, string, string, CancellationToken)
Get Player Get the information for a player.
Declaration
public ApiOperation<PlayerResponse> GetPlayer(string playerId, string projectId, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | playerId | This is the player id. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
LinkExternalId(string, string, LinkExternalIdRequest, string, CancellationToken)
Link External Id Link an External Id to a Unity Authentication account
Declaration
public ApiOperation<LinkExternalIdResponse> LinkExternalId(string idProvider, string projectId, LinkExternalIdRequest linkExternalIdRequest, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | idProvider | This is the id provider type. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
Link |
linkExternalIdRequest | Link External Id request body |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
ReadNotifications(string, string, string, CancellationToken)
Read Notification Gets a player's notifications to be displayed by the client.
Declaration
public ApiOperation<ReadNotificationsResponse> ReadNotifications(string playerId, string projectId, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | playerId | This is the player id. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithCode(string, string, SignInWithCodeRequest, string, CancellationToken)
Sign In With Code Tries to sign in a user with code. In the case this returns 200 and an empty response, poll at regular intervals, 2-5s to avoid being rate limited, until you receive a different response.
Declaration
public ApiOperation<AuthenticationResponse> SignInWithCode(string projectId, string codeLinkSessionId, SignInWithCodeRequest signInWithCodeRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | codeLinkSessionId | An identifier for the device requesting the code sign in. |
Sign |
signInWithCodeRequest | Code Link Request for Sign In |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithCustomID(string, CustomIDRequest, string, CancellationToken)
Custom ID Sign In Sign In using a Custom ID
Declaration
public ApiOperation<AuthenticationResponse> SignInWithCustomID(string projectId, CustomIDRequest customIDRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Custom |
customIDRequest | Custom ID Request for Sign In |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithExternalToken(string, string, SignInWithExternalTokenRequest, string, CancellationToken)
External Token Sign In Authenticate players using external token. The external tokens are from login providers, such as Facebook.
Declaration
public ApiOperation<AuthenticationResponse> SignInWithExternalToken(string idProvider, string projectId, SignInWithExternalTokenRequest signInWithExternalTokenRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | idProvider | This is the id provider type. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
Sign |
signInWithExternalTokenRequest | External Token Authentication request body |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithSessionToken(string, SignInWithSessionTokenRequest, string, CancellationToken)
Session Token Sign In Authenticate players using the session token. Store the session token in a persistent storage in the app or on device.
Declaration
public ApiOperation<AuthenticationResponse> SignInWithSessionToken(string projectId, SignInWithSessionTokenRequest signInWithSessionTokenRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Sign |
signInWithSessionTokenRequest | Session Token Authentication request body |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithUsernamePassword(string, UsernamePasswordRequest, string, CancellationToken)
Username Password Sign In Sign in using the Username Password IdProvider. Store the session token in a persistent storage in the app or on device.
Declaration
public ApiOperation<AuthenticationResponse> SignInWithUsernamePassword(string projectId, UsernamePasswordRequest usernamePasswordRequest, string unityEnvironment = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Username |
usernamePasswordRequest | The Username and Password of the player. |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignUpAnonymously(string, string, SignUpAnonymouslyRequest, CancellationToken)
Anonymous Sign Up Sign-up a new anonymous player.
Declaration
public ApiOperation<AuthenticationResponse> SignUpAnonymously(string projectId, string unityEnvironment = null, SignUpAnonymouslyRequest signUpAnonymouslyRequest = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
Sign |
signUpAnonymouslyRequest | Anonymous Sign Up request body (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
SignUpWithUsernamePassword(string, UsernamePasswordRequest, string, string, CancellationToken)
Username Password Sign Up Create a new player for the Username Password IdProvider. Store the session token in a persistent storage in the app or on device.
Declaration
public ApiOperation<AuthenticationResponse> SignUpWithUsernamePassword(string projectId, UsernamePasswordRequest usernamePasswordRequest, string unityEnvironment = null, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Username |
usernamePasswordRequest | The Username and Password of the player. |
string | unityEnvironment | This is the Environment you want to authorize a player to access. It is the name of the Environment. If this header is not specified, then the default Environment is used. An invalid environment name is not an acceptable input. (optional) |
string | authorization | This is the bearer token for the user authorized to call this API. When this is provided, a user associated with the bearer token is used instead of creating a new user. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
UnlinkExternalId(string, string, UnlinkExternalIdRequest, string, CancellationToken)
Unlink External Id Unlink an external account from a Unity Authentication account.
Declaration
public ApiOperation<UnlinkExternalIdResponse> UnlinkExternalId(string idProvider, string projectId, UnlinkExternalIdRequest unlinkExternalIdRequest, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | idProvider | This is the id provider type. |
string | projectId | This is the Unity Project Id. It is a uuid format. |
Unlink |
unlinkExternalIdRequest | Unlink external Id request body |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
UsernamePasswordUpdatePassword(string, UsernamePasswordPasswordUpdateRequest, string, CancellationToken)
Username Password Update Password Update the password of a player using the Username Password IdProvider. Store the session token in a persistent storage in the app or on device.
Declaration
public ApiOperation<AuthenticationResponse> UsernamePasswordUpdatePassword(string projectId, UsernamePasswordPasswordUpdateRequest usernamePasswordPasswordUpdateRequest, string authorization = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | This is the Unity Project Id. It is a uuid format. |
Username |
usernamePasswordPasswordUpdateRequest | The Username, current Password and new Password of the player. |
string | authorization | This is the bearer token for the user authorized to call this API. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |