Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.81 KB

buildAuthorizationUrl.md

File metadata and controls

52 lines (37 loc) · 1.81 KB

Function: buildAuthorizationUrl()

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


buildAuthorizationUrl(config, parameters): URL

Returns a URL to redirect the user-agent to to request authorization at the Authorization Server

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 sent to PAR

Returns

URL

URL Instance with URL.searchParams including client_id, response_type, and all parameters from the parameters argument

Example

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

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

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