Function: genericGrantRequest()

August 29, 2025 ยท View on GitHub

๐Ÿ’— 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.

Parameters

ParameterTypeDescription
configConfiguration-
grantTypestringGrant Type
parametersRecord<string, string> | URLSearchParamsParameters 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