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​

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

Methods​

MethodReturn TypeDescription
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​

ParameterModifiersTypeDescription
tenantKeystring
userIUser
scopesoptionalScopeType[] | undefined

Method Details​

fetchOrdererToken​

Fetches the orderer token from host.

Signature​

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

Parameters​

ParameterModifiersTypeDescription
tenantIdstringTenant ID.
documentIdoptionalstringOptional. 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​

ParameterTypeDescription
tenantIdstringTenant ID.
documentIdstringDocument ID.

Returns​

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

Return type: Promise<ITokenResponse>