Share via


UserTokenClient class

Client for managing user tokens.

Constructors

UserTokenClient(string)

Creates a new instance of UserTokenClient.

Properties

client

Methods

exchangeTokenAsync(string, string, string, TokenExchangeRequest)

Exchanges the token.

getAadTokens(string, string, string, AadResourceUrls)

Gets the AAD tokens.

getSignInResource(string, string, ConversationReference, ConversationReference)

Gets the sign-in resource.

getTokenOrSignInResource(string, string, string, ConversationReference, ConversationReference, string, string, string)

Gets the token or sign-in resource.

getTokenStatus(string, string, string)

Gets the token status.

getUserToken(string, string, string, string)

Gets the user token.

signOut(string, string, string)

Signs the user out.

updateAuthToken(string)

Constructor Details

UserTokenClient(string)

Creates a new instance of UserTokenClient.

new UserTokenClient(msAppId: string)

Parameters

msAppId

string

The Microsoft application ID.

Property Details

client

client: AxiosInstance

Property Value

AxiosInstance

Method Details

exchangeTokenAsync(string, string, string, TokenExchangeRequest)

Exchanges the token.

function exchangeTokenAsync(userId: string, connectionName: string, channelId: string, tokenExchangeRequest: TokenExchangeRequest): Promise<TokenResponse>

Parameters

userId

string

The user ID.

connectionName

string

The connection name.

channelId

string

The channel ID.

tokenExchangeRequest
TokenExchangeRequest

The token exchange request.

Returns

Promise<TokenResponse>

A promise that resolves to the exchanged token.

getAadTokens(string, string, string, AadResourceUrls)

Gets the AAD tokens.

function getAadTokens(userId: string, connectionName: string, channelId: string, resourceUrls: AadResourceUrls): Promise<Record<string, TokenResponse>>

Parameters

userId

string

The user ID.

connectionName

string

The connection name.

channelId

string

The channel ID.

resourceUrls
AadResourceUrls

The resource URLs.

Returns

Promise<Record<string, TokenResponse>>

A promise that resolves to the AAD tokens.

getSignInResource(string, string, ConversationReference, ConversationReference)

Gets the sign-in resource.

function getSignInResource(msAppId: string, connectionName: string, conversation: ConversationReference, relatesTo?: ConversationReference): Promise<SignInResource>

Parameters

msAppId

string

The application ID.

connectionName

string

The connection name.

conversation
ConversationReference

Returns

Promise<SignInResource>

A promise that resolves to the signing resource.

getTokenOrSignInResource(string, string, string, ConversationReference, ConversationReference, string, string, string)

Gets the token or sign-in resource.

function getTokenOrSignInResource(userId: string, connectionName: string, channelId: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect?: string, fwdUrl?: string): Promise<TokenOrSinginResourceResponse>

Parameters

userId

string

The user ID.

connectionName

string

The connection name.

channelId

string

The channel ID.

conversation
ConversationReference

The conversation reference.

relatesTo
ConversationReference

The related conversation reference.

code

string

The code.

finalRedirect

string

The final redirect URL.

fwdUrl

string

The forward URL.

Returns

A promise that resolves to the token or sign-in resource response.

getTokenStatus(string, string, string)

Gets the token status.

function getTokenStatus(userId: string, channelId: string, include?: string): Promise<TokenStatus[]>

Parameters

userId

string

The user ID.

channelId

string

The channel ID.

include

string

The optional include parameter.

Returns

Promise<TokenStatus[]>

A promise that resolves to the token status.

getUserToken(string, string, string, string)

Gets the user token.

function getUserToken(connectionName: string, channelId: string, userId: string, code?: string): Promise<TokenResponse>

Parameters

connectionName

string

The connection name.

channelId

string

The channel ID.

userId

string

The user ID.

code

string

The optional code.

Returns

Promise<TokenResponse>

A promise that resolves to the user token.

signOut(string, string, string)

Signs the user out.

function signOut(userId: string, connectionName: string, channelId: string): Promise<void>

Parameters

userId

string

The user ID.

connectionName

string

The connection name.

channelId

string

The channel ID.

Returns

Promise<void>

A promise that resolves when the sign-out operation is complete.

updateAuthToken(string)

function updateAuthToken(token: string)

Parameters

token

string