mirror of
https://github.com/hanzoai/openid-client.git
synced 2026-09-24 17:01:10 +00:00
3.0 KiB
3.0 KiB
Function: pollBackchannelAuthenticationGrant()
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.
â–¸ pollBackchannelAuthenticationGrant(config, backchannelAuthenticationResponse, parameters?, options?): Promise<TokenEndpointResponse & TokenEndpointResponseHelpers>
Continuously polls the token endpoint until the end-user finishes the Client-Initiated Backchannel Authentication Grant process
Note
URL of the authorization server's token endpoint must be configured.
Parameters
| Parameter | Type | Description |
|---|---|---|
config |
Configuration |
- |
backchannelAuthenticationResponse |
BackchannelAuthenticationResponse |
Backchannel Authentication Response obtained from initiateBackchannelAuthentication |
parameters? |
Record<string, string> | URLSearchParams |
Additional parameters that will be sent to the token endpoint, typically used for parameters such as scope and a resource (Resource Indicator) |
options? |
BackchannelAuthenticationGrantPollOptions |
- |
Returns
Promise<TokenEndpointResponse & TokenEndpointResponseHelpers>
Example
let config!: client.Configuration
let scope!: string
let login_hint!: string // one of login_hint, id_token_hint, or login_hint_token parameters must be provided in CIBA
let backchannelAuthenticationResponse =
await client.initiateBackchannelAuthentication(config, {
scope,
login_hint,
})
// OPTIONAL: If your client is configured with Ping Mode you'd invoke the following after getting the CIBA Ping Callback (its implementation is framework specific and therefore out of scope for openid-client)
let { auth_req_id } = backchannelAuthenticationResponse
let tokenEndpointResponse =
await client.pollBackchannelAuthenticationGrant(
config,
backchannelAuthenticationResponse,
)