Skip to content

Commit 42ac681

Browse files
committed
support custom parameters
1 parent 094ca26 commit 42ac681

File tree

1 file changed

+9
-0
lines changed
  • src/runtime/server/lib/oauth

1 file changed

+9
-0
lines changed

src/runtime/server/lib/oauth/oidc.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export interface OAuthOidcConfig {
3636
* @default process.env.NUXT_OAUTH_OIDC_REDIRECT_URL
3737
*/
3838
redirectURL?: string
39+
/**
40+
* Additional custom parameters that are passed to the specific endpoint requests.
41+
* Can be used to provide custom (query) parameters.
42+
*/
43+
parameters?: Partial<Record<'authorization_endpoint' | 'token_endpoint' | 'userinfo_endpoint', object>>
44+
3945
}
4046

4147
/**
@@ -266,6 +272,7 @@ export function defineOAuthOidcEventHandler<TUser = OidcUser>({ config, onSucces
266272
response_type: 'code',
267273
code_challenge: verifier.code_challenge,
268274
code_challenge_method: verifier.code_challenge_method,
275+
...config.parameters?.authorization_endpoint,
269276
}),
270277
)
271278
}
@@ -281,6 +288,7 @@ export function defineOAuthOidcEventHandler<TUser = OidcUser>({ config, onSucces
281288
redirect_uri: redirectURL,
282289
code: query.code,
283290
code_verifier: verifier.code_verifier,
291+
...config.parameters?.token_endpoint,
284292
},
285293
})
286294

@@ -296,6 +304,7 @@ export function defineOAuthOidcEventHandler<TUser = OidcUser>({ config, onSucces
296304
headers: {
297305
Authorization: `${tokens.token_type} ${tokens.access_token}`,
298306
},
307+
body: config.parameters?.userinfo_endpoint,
299308
})
300309
}
301310

0 commit comments

Comments
 (0)