Skip to content

Commit

Permalink
fix(oidc): Handling of errors returned from authorize endpoint (#1250)…
Browse files Browse the repository at this point in the history
… (release)
  • Loading branch information
guillaume-chervet committed Dec 28, 2023
1 parent 3f1d2d7 commit 9ef56f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/oidc-client/src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ export const loginCallbackAsync = (oidc) => async (isSilentSignin = false) => {
}

const params = getParseQueryStringFromLocation(href);

if(params.error || params.error_description) {
throw new Error(`Error from OIDC server: ${params.error} - ${params.error_description}`);
}

if (params.iss && params.iss !== oidcServerConfiguration.issuer) {
console.error();
throw new Error(`issuer not valid (expected: ${oidcServerConfiguration.issuer}, received: ${params.iss})`);
throw new Error(`Issuer not valid (expected: ${oidcServerConfiguration.issuer}, received: ${params.iss})`);
}
if (params.state && params.state !== state) {
throw new Error(`state not valid (expected: ${state}, received: ${params.state})`);
throw new Error(`State not valid (expected: ${state}, received: ${params.state})`);
}

const data = {
Expand Down

0 comments on commit 9ef56f1

Please sign in to comment.