[BUG] Improve handling of cancelled GitHub OAuth login (shows 401 instead of user-friendly message)
Describe the bug
When a user tries to sign up/login using GitHub OAuth and clicks "Cancel" instead of "Authorize", the application returns a raw error response:
"No user information from OAuth provider" with status 401 Unauthorized.
This is not user-friendly and misleading, as the user intentionally cancelled the login process.
Steps To Reproduce
- Go to the signup/login page
- Click on "Sign in with GitHub"
- On the GitHub authorization screen, click "Cancel"
- Observe the error response shown on the screen
Expected behavior
When the user cancels the OAuth flow, the application should detect the
error=access_denied parameter and display a user-friendly message such as:
"Login cancelled by user" or "Authorization was denied"
Instead of showing a 401 Unauthorized error.
Packages
(Not sure / can be filled by running npm run refine whoami if required)
Additional Context
The backend seems to assume that OAuth always succeeds and does not handle
the cancellation (error=access_denied) case properly.
Handling this case will improve user experience and prevent confusing error messages.
Hi, I’d like to work on this issue
please assign me this task
Hi 👋 I’d like to work on this issue if it’s still available.
Hey Please Assign Me This Task I Want To Work On it
Hi I would also like to work on this issue if this problem still persists.
Hey, I would like to work on this. Please assign if possible.
Hey I would love to work on this . Kindly assign this issue to me
Hi, I’d like to work on this.
@hirdeshds
I dug into this a bit, and it looks like the OAuth failure in the screenshot may be happening in a hosted Refine Cloud / preview flow rather than a local example app. The browser seems to stop at the backend callback URL (cloud2.refine.dev/oauth/github/callback?error=access_denied&...) and return a raw 401 JSON response before it ever gets redirected back to the login page.
I’ve been working on a frontend-side improvement so that if the login page receives error=access_denied, it shows a user-friendly notification instead of a generic auth failure. But based on the screenshot, it seems like there may also be a separate backend-side fix needed here, since the current flow appears to fail before the user returns to the login page.
Can you confirm whether this reproduction is happening in a hosted Refine Cloud / preview environment or in a local example app?
Can i work on this issue?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
good