Skip to content

Commit

Permalink
chore(passport): add response type parameter to authorization paramet…
Browse files Browse the repository at this point in the history
…ers (#2682)
  • Loading branch information
szkl committed Sep 14, 2023
1 parent 9e2db19 commit d7b879e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/passport/app/routes/authenticate/$clientId/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ export const action: ActionFunction = async ({ request, context, params }) => {
params.clientId
)

const { redirectUri, state, scope, clientId, prompt } = authzCookieParams
const { redirectUri, state, scope, clientId, prompt, responseType } =
authzCookieParams

const qp = new URLSearchParams()
qp.append('client_id', clientId)
qp.append('redirect_uri', redirectUri)
qp.append('state', state)
qp.append('scope', scope.join(' '))
qp.append('response_type', responseType)

if (prompt) qp.append('prompt', prompt)

Expand Down
1 change: 1 addition & 0 deletions apps/passport/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare global {

interface AuthzParams {
clientId: string
response_type: string
redirectUri: string
scope: string[]
state: string
Expand Down
2 changes: 2 additions & 0 deletions apps/passport/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type CustomDomainRequest = Request & {
export function parseParams(request: Request) {
const url = new URL(request.url)
const clientId = url.searchParams.get('client_id') || ''
const responseType = url.searchParams.get('response_type') || ''
const state = url.searchParams.get('state') || ''
const redirectUri = url.searchParams.get('redirect_uri') || ''
const scope = url.searchParams.get('scope')
Expand All @@ -44,6 +45,7 @@ export function parseParams(request: Request) {

return {
clientId,
responseType,
state,
redirectUri,
scope: decodedScope ? decodedScope.split(' ') : [],
Expand Down

0 comments on commit d7b879e

Please sign in to comment.