docs.unity3d.com
    Show / Hide Table of Contents

    Class PersonalAccessTokenProvider

    An IAuthenticator implementation that expects a personal access token (PAT) from a provided -DT_PERSONAL_ACCESS_TOKEN launch argument or a DT_PERSONAL_ACCESS_TOKEN environment variable.

    Inheritance
    Object
    PersonalAccessTokenProvider
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Cloud.Identity
    Syntax
    public class PersonalAccessTokenProvider : IAuthenticator, IAccessTokenProvider, IAuthenticationStateProvider
    Examples

    Constructors

    PersonalAccessTokenProvider(IAuthenticationPlatformSupport)

    Returns an IAccessTokenProvider implementation that expects a personal access token (PAT) from a provided -UNITY_CLOUD_PERSONAL_ACCESS_TOKEN launch argument or a UNITY_CLOUD_PERSONAL_ACCESS_TOKEN environment variable.

    Declaration
    public PersonalAccessTokenProvider(IAuthenticationPlatformSupport authenticationPlatformSupport)
    Parameters
    Type Name Description
    IAuthenticationPlatformSupport authenticationPlatformSupport

    The IAuthenticationPlatformSupport that handles PAT injection.

    Remarks

    A Unity user account is required to generate a valid PAT from the Unity Cloud online dashboard.

    Fields

    s_PersonalAccessTokenKeyName

    The expected key name in launch arguments that holds the personal access token value.

    Declaration
    public static readonly string s_PersonalAccessTokenKeyName
    Field Value
    Type Description
    String

    Properties

    AuthenticationState

    Holds the current AuthenticationState.

    Declaration
    public AuthenticationState AuthenticationState { get; }
    Property Value
    Type Description
    AuthenticationState
    Implements
    IAuthenticationStateProvider.AuthenticationState

    Methods

    GetAccessTokenAsync()

    Declaration
    public Task<string> GetAccessTokenAsync()
    Returns
    Type Description
    Task<String>
    Implements
    IAccessTokenProvider.GetAccessTokenAsync()

    HasValidPreconditionsAsync()

    Indicates if the PersonalAccessTokenProvider running instance has detected injection of a personal access token.

    Declaration
    public Task<bool> HasValidPreconditionsAsync()
    Returns
    Type Description
    Task<Boolean>

    If the PersonalAccessTokenProvider running instance has detected injection of a personal access token.

    Implements
    IAuthenticator.HasValidPreconditionsAsync()

    InitializeAsync()

    A task to initialize the AuthenticationState from either cache or direct injection value.

    Declaration
    public Task InitializeAsync()
    Returns
    Type Description
    Task
    Implements
    IAuthenticator.InitializeAsync()

    Events

    AuthenticationStateChanged

    Triggers when the AuthenticationState of the current user changes.

    Declaration
    public event Action<AuthenticationState> AuthenticationStateChanged
    Event Type
    Type Description
    Action<AuthenticationState>
    Implements
    IAuthenticationStateProvider.AuthenticationStateChanged
    Remarks

    Subscribers of this event should restrict or allow access to available resources and features based on the returned value.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023