UserTokenClientImpl class
- Extends
Constructors
User |
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 |
Asynchronously Get the raw signin resource to be sent to the user for signin. |
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. |
Constructor Details
UserTokenClientImpl(string, ServiceClientCredentials, string, ConnectorClientOptions)
new UserTokenClientImpl(appId: string, credentials: ServiceClientCredentials, oauthEndpoint: string, connectorClientOptions?: ConnectorClientOptions)
Parameters
- appId
-
string
The appId.
- credentials
-
ServiceClientCredentials
AppCredentials for OAuth.
- oauthEndpoint
-
string
The OAuth API endpoint.
- connectorClientOptions
- ConnectorClientOptions
A ConnectorClientOptions object.
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 promise representing the result of the operation.
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 promise of Dictionary of resourceUrl to the corresponding TokenResponse.
getSignInResource(string, Activity, string)
Asynchronously Get the raw signin resource to be sent to the user for signin.
function getSignInResource(connectionName: string, activity: Activity, finalRedirect: 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.
- finalRedirect
-
string
The final URL that the OAuth flow will redirect to.
Returns
Promise<SignInUrlResponse>
The SignInUrlResponse resource.
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 promise with an Array of the Token Status.
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>
The token Response.
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>