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.
▸ pollDeviceAuthorizationGrant(config
, deviceAuthorizationResponse
, parameters
?, options
?): Promise
<TokenEndpointResponse
& TokenEndpointResponseHelpers
>
Continuously polls the token endpoint until the end-user finishes the Device Authorization Grant process on their secondary device
Note: URL of the authorization server's token endpoint must be configured.
Parameter | Type | Description |
---|---|---|
config |
Configuration |
- |
deviceAuthorizationResponse |
DeviceAuthorizationResponse |
Device Authorization Response obtained from initiateDeviceAuthorization |
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 ? |
DeviceAutorizationGrantPollOptions |
- |
Promise
<TokenEndpointResponse
& TokenEndpointResponseHelpers
>
let config!: client.Configuration
let scope!: string
let deviceAuthorizationResponse =
await client.initiateDeviceAuthorization(config, { scope })
let { user_code, verification_uri, verification_uri_complete } =
deviceAuthorizationResponse
console.log({ user_code, verification_uri, verification_uri_complete })
let tokenEndpointResponse = await client.pollDeviceAuthorizationGrant(
config,
deviceAuthorizationResponse,
)