AccessToken
A thin wrapper around the raw JSON returned from the authorization server to represent an access token
Test:
Constructor Summary
| Public Constructor | ||
| public |
constructor(json: Object) |
|
Member Summary
| Public Members | ||
| public get |
Returns the access token itself (40-character alphanumeric string) |
|
| public get |
Returns the TTL (in milliseconds) until this access token expires. |
|
Method Summary
| Public Methods | ||
| public |
Returns whether or not this access token has expired. |
|
| public |
A convenience function to cast this object back to a string, generally only used by the Logger class. |
|
| public |
validate() Ensure that the given access token model is valid |
|
Public Constructors
Public Members
public get token: string source
Returns the access token itself (40-character alphanumeric string)
Test:
public get ttl: number source
Returns the TTL (in milliseconds) until this access token expires. If you are using an auth proxy and have
correctly configured the refreshTokenUrl, this SDK will automatically refresh expired access tokens for you,
so consumers typically do not need to worry about whether or not a token is expired or about to expire.
Test:
Public Methods
public isExpired(): boolean source
Returns whether or not this access token has expired. Note that due to network latency, etc., it's possible that the internally-stored expiry date could be about a second or so behind, and so this function is not guaranteed to be perfectly accurate.
Test:
public toString(): string source
A convenience function to cast this object back to a string, generally only used by the Logger class.
In this case, we return only the access_token itself, since the rest of the object is typically not useful.
Test:
public validate() source
Ensure that the given access token model is valid
Throw:
if access token model is invalid |