SasCredential class
SasCredential is a Credential used to generate a SasCredentialPolicy. Renew token by setting a new token string value to token property.
Example
const sasCredential = new SasCredential("token"); const pipeline = MapsURL.newPipeline(sasCredential);
const searchURL = new SearchURL(pipeline);
// Set up a timer to refresh the token const timerID = setInterval(() => { // Update token by accessing to public sasCredential.token sasCredential.token = "updatedToken"; // WARNING: Timer must be manually stopped! It will forbid GC of sasCredential if (shouldStop()) { clearInterval(timerID); } }, 60 * 60 * 1000); // Set an interval time before your token expired
- Extends
Constructors
Sas |
Creates an instance of SasCredential. |
Properties
token | Mutable token value. You can set a renewed token value to this property, for example, when a token is expired. |
Methods
create(Request |
Creates a SasCredentialPolicy object. |
Constructor Details
SasCredential(string)
Creates an instance of SasCredential.
new SasCredential(token: string)
Parameters
- token
-
string
Property Details
token
Mutable token value. You can set a renewed token value to this property, for example, when a token is expired.
token: string
Property Value
string
Method Details
create(RequestPolicy, RequestPolicyOptions)
Creates a SasCredentialPolicy object.
function create(nextPolicy: RequestPolicy, options: RequestPolicyOptions): SasCredentialPolicy
Parameters
- nextPolicy
-
RequestPolicy
- options
-
RequestPolicyOptions