DeviceCode
A thin wrapper around the raw JSON returned from the authorization server to represent a device code/user code pair
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) |
Member Summary
Public Members | ||
public get |
Returns the interval (in milliseconds) at which the client (in this case the SDK) should poll the |
|
public get |
Returns the TTL (in milliseconds) until this device code/user code pair expires. |
|
public get |
Returns the user code (8-character alphanumeric string) |
|
public get |
Returns the verification URL (the place where the user should go on their mobile device or laptop to log in) |
Method Summary
Public Methods | ||
public |
Returns whether or not this device code/user code pair 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 device code model is valid |
Public Constructors
Public Members
public get interval: number source
Returns the interval (in milliseconds) at which the client (in this case the SDK) should poll the POST /token
endpoint (or the OAuth proxy that lies in between). Consumers of the SDK should generally not have to use this
value directly.
Test:
public get ttl: number source
Returns the TTL (in milliseconds) until this device code/user code pair expires. The SDK will automatically generate a new key pair upon expiry, so consumers of the SDK will generally not have to use this value directly; however, you may opt to display on the screen how much time the user has left to log in before a new code is generated.
Test:
Public Methods
public isExpired(): boolean source
Returns whether or not this device code/user code pair 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 the raw JSON string representing the entire object.
Test:
public validate() source
Ensure that the given device code model is valid
Throw:
if device code model is invalid |