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

The base Oauth2 callback doesn't account for the user denying access at the provider stage #45

Open
colingourlay opened this issue Aug 5, 2021 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@colingourlay
Copy link

colingourlay commented Aug 5, 2021

The callback implementation always assumes that the code query param will always exist and can be fed into getTokens, and tokens in turn will exist and be fed into getUserProfile:

const code = query.get("code");
const redirect = this.getStateValue(query, "redirect");
const tokens = await this.getTokens(code!, this.getCallbackUri(auth, host));
let user = await this.getUserProfile(tokens);

In my particular use case, I implemented login with GitHub, but if I choose to cancel, rather than share my account with the app, I'm redirected to /api/auth/callback/github?error=access_denied&error_description=The+user+has+denied+your+application+access.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23access-denied&state=cmVkaXJlY3Q9Lw%3D%3D.

No code param exists, so the callback page 500s. I'm not sure if error and error_description are unique to GitHub, but perhaps we can use them to handle this situation more gracefully?

@Dan6erbond
Copy link
Owner

Hey there, yes, this is true. SK-Auth is still in development and error-handling is on the TODO. Will keep you updated!

@Dan6erbond Dan6erbond self-assigned this Jan 12, 2022
@Dan6erbond Dan6erbond added the help wanted Extra attention is needed label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants