Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying OIDC url state parameter for passing data to callback #4068

Merged
merged 8 commits into from
Feb 19, 2024
6 changes: 5 additions & 1 deletion src/oidc/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const generateAuthorizationUrl = async (
* @param nonce - state
* @param prompt - indicates to the OP which flow the user should see - eg login or registration
* See https://openid.net/specs/openid-connect-prompt-create-1_0.html#name-prompt-parameter
* @param urlState - value to append to the opaque state identifier to uniquely identify the callback
* @returns a Promise with the url as a string
*/
export const generateOidcAuthorizationUrl = async ({
Expand All @@ -139,6 +140,7 @@ export const generateOidcAuthorizationUrl = async ({
identityServerUrl,
nonce,
prompt,
urlState,
}: {
clientId: string;
metadata: ValidatedIssuerMetadata;
Expand All @@ -147,8 +149,9 @@ export const generateOidcAuthorizationUrl = async ({
redirectUri: string;
nonce: string;
prompt?: string;
urlState?: string;
}): Promise<string> => {
const scope = await generateScope();
const scope = generateScope();
const oidcClient = new OidcClient({
...metadata,
client_id: clientId,
Expand All @@ -164,6 +167,7 @@ export const generateOidcAuthorizationUrl = async ({
state: userState,
nonce,
prompt,
url_state: urlState,
});

return request.url;
Expand Down
Loading