Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.43 KB

genericGrantRequest.md

File metadata and controls

54 lines (38 loc) · 2.43 KB

Function: genericGrantRequest()

💗 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.


genericGrantRequest(config, grantType, parameters, options?): Promise<TokenEndpointResponse & TokenEndpointResponseHelpers>

Performs any Grant request at the token endpoint. The purpose is to be able to execute grant requests such as Token Exchange Grant, JWT Bearer Token Grant, SAML 2.0 Bearer Assertion Grant, or any other grant.

Note: URL of the authorization server's token endpoint must be configured.

Parameters

Parameter Type Description
config Configuration -
grantType string Grant Type
parameters Record<string, string> | URLSearchParams Parameters required by the given grant type to send to the token endpoint
options? DPoPOptions -

Returns

Promise<TokenEndpointResponse & TokenEndpointResponseHelpers>

Example

Requesting an Access Token using the JWT Bearer Token Grant

let config!: client.Configuration
let scope!: string
let resource!: string
let assertion!: string

let tokenEndpointResponse = await client.genericGrantRequest(
  config,
  'urn:ietf:params:oauth:grant-type:jwt-bearer',
  { scope, resource, assertion },
)

See