Class PersonalAccessTokenProvider
An IAccessTokenProvider implementation that expects a PAT (personal access token) from a provided -DT_PERSONAL_ACCESS_TOKEN launch argument or a DT_PERSONAL_ACCESS_TOKEN environment variable.
Implements
Inherited Members
Namespace: Unity.DigitalTwins.Identity
Assembly: solution.dll
Syntax
public class PersonalAccessTokenProvider : IAccessTokenProvider
Constructors
PersonalAccessTokenProvider(IActivatePlatformSupport)
Returns an IAccessTokenProvider implementation that expects a PAT (personal access token) from a provided -DT_PERSONAL_ACCESS_TOKEN launch argument or a DT_PERSONAL_ACCESS_TOKEN environment variable.
Declaration
public PersonalAccessTokenProvider(IActivatePlatformSupport platformSupport = null)
Parameters
Type | Name | Description |
---|---|---|
IActivatePlatformSupport | platformSupport | The IActivatePlatformSupport that handles launch arguments processing. |
Remarks
A Unity User account is required to generate a valid PAT from the Unity Digital Twins online dashboard.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if Personal Access Token is missing in launch arguments or environment variables. |
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 |
Methods
GetAccessTokenAsync()
Awaitable call to fetch the user access token.
Declaration
public Task<string> GetAccessTokenAsync()
Returns
Type | Description |
---|---|
Task<String> | A Task that results in the string value of the user access token when completed. |