Class Token
Encapsulates the access token used to authenticate with the USim service.
Namespace: Unity.Simulation.Client
Syntax
public class Token
Properties
accessToken
Returns the access token.
Declaration
public string accessToken { get; }
Property Value
Type | Description |
---|---|
String |
isExpired
Returns true if the access token has expired, false otherwise.
Declaration
public bool isExpired { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Load(String, Boolean)
Loads a token from peristent storage.
Declaration
public static Token Load(string tokenFile = null, bool refreshIfExpired = true)
Parameters
Type | Name | Description |
---|---|---|
String | tokenFile | Path to the token file to laod. Can be null. Defaults to ~/.usim/token.json |
Boolean | refreshIfExpired | When true, will automatically refresh the token if it has expired. Defaults to true. |
Returns
Type | Description |
---|---|
Token |
Refresh(Int32)
Refresh the current token.
Declaration
public void Refresh(int timeoutSeconds = 30)
Parameters
Type | Name | Description |
---|---|---|
Int32 | timeoutSeconds | Timeout for attempting to refresh the token. |
Save(String)
Saves this token to persisten storage.
Declaration
public void Save(string tokenFile = null)
Parameters
Type | Name | Description |
---|---|---|
String | tokenFile | Path to the token file to laod. Can be null. Defaults to ~/.usim/token.json |