From d7b879e01a16daadb7cd45ee58eaf17c2c7e1ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nmez=20Kartal?= Date: Thu, 14 Sep 2023 23:04:22 +0300 Subject: [PATCH] chore(passport): add response type parameter to authorization parameters (#2682) --- apps/passport/app/routes/authenticate/$clientId/account.tsx | 4 +++- apps/passport/bindings.d.ts | 1 + apps/passport/server.ts | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/passport/app/routes/authenticate/$clientId/account.tsx b/apps/passport/app/routes/authenticate/$clientId/account.tsx index 8328c859f0..46a196d4a5 100644 --- a/apps/passport/app/routes/authenticate/$clientId/account.tsx +++ b/apps/passport/app/routes/authenticate/$clientId/account.tsx @@ -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) diff --git a/apps/passport/bindings.d.ts b/apps/passport/bindings.d.ts index c5133a4085..bd403058e3 100644 --- a/apps/passport/bindings.d.ts +++ b/apps/passport/bindings.d.ts @@ -55,6 +55,7 @@ declare global { interface AuthzParams { clientId: string + response_type: string redirectUri: string scope: string[] state: string diff --git a/apps/passport/server.ts b/apps/passport/server.ts index e1ad93b335..344caa73f4 100644 --- a/apps/passport/server.ts +++ b/apps/passport/server.ts @@ -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') @@ -44,6 +45,7 @@ export function parseParams(request: Request) { return { clientId, + responseType, state, redirectUri, scope: decodedScope ? decodedScope.split(' ') : [],