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

Return errors to clients without throwing them #24

Open
jmandel opened this issue Sep 16, 2021 · 0 comments
Open

Return errors to clients without throwing them #24

jmandel opened this issue Sep 16, 2021 · 0 comments
Assignees

Comments

@jmandel
Copy link
Member

jmandel commented Sep 16, 2021

if (token.code_challenge_method === 'S256') {
const hash = crypto.createHash('sha256');
hash.update(this.request.body.code_verifier || "");
const code_challenge = jose.util.base64url.encode(hash.digest());
if (code_challenge !== token.code_challenge) {
throw Lib.OAuthError.from({
code : 401,
error: "invalid_grant",
msg : "Invalid grant or Invalid PKCE Verifier, '%s' vs '%s'."
}, code_challenge, token.code_challenge);
}
}

these "throw" statements are causing the server to crash, instead of returning an error to the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants