Skip to main content
Version: v1

InsecureTokenProvider Class

Provides an in memory implementation of ITokenProvider that can be used to insecurely connect to the Fluid Relay.

As the name implies, this is not secure and should not be used in production. It simply makes examples where authentication is not relevant easier to bootstrap.

Signature

export declare class InsecureTokenProvider implements ITokenProvider

Implements: ITokenProvider

Constructors

Constructor Description
(constructor)(tenantKey, user, scopes) Constructs a new instance of the InsecureTokenProvider class

Methods

Method Return Type Description
fetchOrdererToken(tenantId, documentId) Promise<ITokenResponse> Fetches the orderer token from host.
fetchStorageToken(tenantId, documentId) Promise<ITokenResponse> Fetches the storage token from host.

Constructor Details

(constructor)

Constructs a new instance of the InsecureTokenProvider class

Signature

constructor(
tenantKey: string,
user: IUser,
scopes?: ScopeType[] | undefined);

Parameters

Parameter Modifiers Type Description
tenantKey string
user IUser
scopes optional ScopeType[] | undefined

Method Details

fetchOrdererToken

Fetches the orderer token from host.

Signature

fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;

Parameters

Parameter Modifiers Type Description
tenantId string Tenant ID.
documentId optional string Optional. Document ID is only required for document-scoped requests.

Returns

TokenResponse object representing token value along with flag indicating whether token came from cache.

Return type: Promise<ITokenResponse>

fetchStorageToken

Fetches the storage token from host.

Signature

fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;

Parameters

Parameter Type Description
tenantId string Tenant ID.
documentId string Document ID.

Returns

TokenResponse object representing token value along with flag indicating whether token came from cache.

Return type: Promise<ITokenResponse>