@fluidframework/azure-service-utils Package
Packages > @fluidframework/azure-service-utils
A set of helper utilities for building backend APIs for use with Azure Fluid Relay .
Remarks
Note that this library’s primary entry-point (generateToken(tenantId, key, scopes, documentId, user, lifetime, ver) ) is only intended to be run in a browser context. It is **not** Node.js-compatible.
Functions
Function | Alerts | Return Type | Description |
---|---|---|---|
generateToken(tenantId, key, scopes, documentId, user, lifetime, ver) | Legacy , Alpha |
string | Generates a JSON Web Token (JWT) to authorize access to a Routerlicious-based Fluid service. |
Function Details
generateToken
Generates a JSON Web Token (JWT) to authorize access to a Routerlicious-based Fluid service.
This API is provided for existing users, but is not recommended for new users.
To use, import via @fluidframework/azure-service-utils/legacy
.
For more information about our API support guarantees, see here .
Signature
export declare function generateToken(tenantId: string, key: string, scopes: ScopeType[], documentId?: string, user?: IUser, lifetime?: number, ver?: string): string;
Remarks
Note: this function uses a browser friendly auth library (jsrsasign ) and may only be used in client (browser) context. It is **not** Node.js-compatible.
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
tenantId | string | See tenantId | |
key | string | API key to authenticate user. Must be UTF-8-encoded. | |
scopes | ScopeType[] | See scopes | |
documentId | optional | string | See documentId. If not specified, the token will not be associated with a document, and an empty string will be used. |
user | optional | IUser | User with whom generated tokens will be associated. If not specified, the token will not be associated with a user, and a randomly generated mock user will be used instead. See user |
lifetime | optional | number | Used to generate the expiration. Expiration = now + lifetime. Expressed in seconds. Default: 3600 (1 hour). |
ver | optional | string | See ver. Default: 1.0 . |
Returns
Return type: string