Fix issue#7407
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://refine.dev/docs/guides-concepts/contributing/#commit-convention
Bugs / Features
- [x] Related issue(s) linked
- [ ] Tests for the changes have been added
- [ ] Docs have been added / updated
- [ ] Changesets have been added https://refine.dev/docs/guides-concepts/contributing/#creating-a-changeset
What is the current behavior?
When a user tries to sign up or log in using GitHub OAuth and clicks Cancel instead of Authorize on the GitHub authorization screen, the application does not handle the cancelled OAuth flow properly.
GitHub redirects back with the error=access_denied query parameter, but the application continues the OAuth flow as if authorization was successful. As a result, it tries to retrieve user information from the OAuth provider and shows a raw error response:
No user information from OAuth provider
with a 401 Unauthorized status.
This is misleading because the user intentionally cancelled the authorization process.
What is the new behavior?
The application now detects the GitHub OAuth cancellation case by checking for the error=access_denied query parameter.
When the user cancels the GitHub authorization flow, the app handles this case gracefully and shows a user-friendly message instead of displaying the raw 401 Unauthorized error.
For example, the user can now see a message such as:
Login cancelled by user
or
Authorization was denied
This improves the user experience and prevents cancelled OAuth flows from being treated as unexpected authentication failures.
fixes #7407
Notes for reviewers
This change specifically handles the OAuth cancellation scenario where GitHub returns error=access_denied.
The goal is to prevent the app from attempting to fetch user information when the user has explicitly denied authorization.
Please let me know if this behavior should be handled differently, for example by redirecting the user back to the login page with a query parameter instead of displaying a message directly.
⚠️ No Changeset found
Latest commit: a48dcbab30a1412ef0bad3b7609771d5a6153786
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR