mirror of
https://github.com/hanzoai/openid-client.git
synced 2026-09-24 17:01:10 +00:00
1.8 KiB
1.8 KiB
Function: initiateDeviceAuthorization()
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.
â–¸ initiateDeviceAuthorization(config, parameters): Promise<DeviceAuthorizationResponse>
Initiates a Device Authorization Grant using parameters from the
parameters argument.
Note
URL of the authorization server's device authorization endpoint must be configured.
Parameters
| Parameter | Type | Description |
|---|---|---|
config |
Configuration |
- |
parameters |
Record<string, string> | URLSearchParams |
Authorization request parameters that will be sent to the device authorization endpoint |
Returns
Promise<DeviceAuthorizationResponse>
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 })