Skip to content

Latest commit

 

History

History
91 lines (70 loc) · 3.21 KB

buildAuthorizationUrlWithJAR.md

File metadata and controls

91 lines (70 loc) · 3.21 KB

Function: buildAuthorizationUrlWithJAR()

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


buildAuthorizationUrlWithJAR(config, parameters, signingKey, options?): Promise<URL>

Returns a URL to redirect the user-agent to to request authorization at the Authorization Server with a prior step of using JAR

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

Parameters

Parameter Type Description
config Configuration -
parameters Record<string, string> | URLSearchParams Authorization request parameters that will be encoded in a JAR Request Object
signingKey CryptoKey | PrivateKey Key to sign the JAR Request Object with.
options? ModifyAssertionOptions -

Returns

Promise<URL>

URL Instance with URL.searchParams including client_id and request

Examples

Using JAR

let config!: client.Configuration
let redirect_uri!: string
let scope!: string
let key!: client.CryptoKey

// these must be unique for every single authorization request
let code_verifier = client.randomPKCECodeVerifier()
let code_challenge =
  await client.calculatePKCECodeChallenge(code_verifier)

let redirectTo = await client.buildAuthorizationUrlWithJAR(
  config,
  {
    redirect_uri,
    scope,
    code_challenge,
    code_challenge_method: 'S256',
  },
  key,
)
// redirect now

Using JAR and PAR together

let config!: client.Configuration
let redirect_uri!: string
let scope!: string
let key!: client.CryptoKey

// these must be unique for every single authorization request
let code_verifier = client.randomPKCECodeVerifier()
let code_challenge =
  await client.calculatePKCECodeChallenge(code_verifier)

let { searchParams: params } = await client.buildAuthorizationUrlWithJAR(
  config,
  {
    redirect_uri,
    scope,
    code_challenge,
    code_challenge_method: 'S256',
  },
  key,
)

let redirectTo = await client.buildAuthorizationUrlWithPAR(
  config,
  params,
)
// redirect now