Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 2.58 KB

pollDeviceAuthorizationGrant.md

File metadata and controls

50 lines (34 loc) · 2.58 KB

Function: pollDeviceAuthorizationGrant()

💗 Help the project

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.

Parameters

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 -

Returns

Promise<TokenEndpointResponse & TokenEndpointResponseHelpers>

Example

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,
)