UserTokenClient class
Client for access user token service.
Methods
exchange |
Performs a token exchange operation such as for single sign-on. |
get |
Retrieves Azure Active Directory tokens for particular resources on a configured connection. |
get |
Get the raw signin link to be sent to the user for signin for a connection name. |
get |
Retrieves the token status for each configured connection for the given user. |
get |
Attempts to retrieve the token for a user that's in a login flow. |
sign |
Signs the user out with the token server. |
Method Details
exchangeToken(string, string, string, TokenExchangeRequest)
Performs a token exchange operation such as for single sign-on.
function exchangeToken(userId: string, connectionName: string, channelId: string, exchangeRequest: TokenExchangeRequest): Promise<TokenResponse>
Parameters
- userId
-
string
The user id that will be associated with the token.
- connectionName
-
string
Name of the auth connection to use.
- channelId
-
string
The channel Id that will be associated with the token.
- exchangeRequest
-
TokenExchangeRequest
The exchange request details, either a token to exchange or a uri to exchange.
Returns
Promise<TokenResponse>
A TokenResponse object.
getAadTokens(string, string, string[], string)
Retrieves Azure Active Directory tokens for particular resources on a configured connection.
function getAadTokens(userId: string, connectionName: string, resourceUrls: string[], channelId: string): Promise<Record<string, TokenResponse>>
Parameters
- userId
-
string
The user id that will be associated with the token.
- connectionName
-
string
Name of the auth connection to use.
- resourceUrls
-
string[]
The list of resource URLs to retrieve tokens for.
- channelId
-
string
The channel Id that will be associated with the token.
Returns
Promise<Record<string, TokenResponse>>
A Dictionary of resourceUrls to the corresponding TokenResponse.
getSignInResource(string, Activity, string)
Get the raw signin link to be sent to the user for signin for a connection name.
function getSignInResource(connectionName: string, activity: Activity, finalRediect: string): Promise<SignInUrlResponse>
Parameters
- connectionName
-
string
Name of the auth connection to use.
- activity
-
Activity
The Activity from which to derive the token exchange state.
- finalRediect
-
string
The final URL that the OAuth flow will redirect to.
Returns
Promise<SignInUrlResponse>
getTokenStatus(string, string, string)
Retrieves the token status for each configured connection for the given user.
function getTokenStatus(userId: string, channelId: string, includeFilter: string): Promise<TokenStatus[]>
Parameters
- userId
-
string
The user id that will be associated with the token.
- channelId
-
string
The channel Id that will be associated with the token.
- includeFilter
-
string
The includeFilter.
Returns
Promise<TokenStatus[]>
A list of TokenStatus objects.
getUserToken(string, string, string, string)
Attempts to retrieve the token for a user that's in a login flow.
function getUserToken(userId: string, connectionName: string, channelId: string, magicCode: string): Promise<TokenResponse>
Parameters
- userId
-
string
The user id that will be associated with the token.
- connectionName
-
string
Name of the auth connection to use.
- channelId
-
string
The channel Id that will be associated with the token.
- magicCode
-
string
(Optional) Optional user entered code to validate.
Returns
Promise<TokenResponse>
A TokenResponse object.
signOutUser(string, string, string)
Signs the user out with the token server.
function signOutUser(userId: string, connectionName: string, channelId: string): Promise<void>
Parameters
- userId
-
string
The user id that will be associated with the token.
- connectionName
-
string
Name of the auth connection to use.
- channelId
-
string
The channel Id that will be associated with the token.
Returns
Promise<void>