Skip to content

fix(examples): handle OAuth access_denied in auth-headless example#7437

Open
SpencerJung wants to merge 1 commit into
refinedev:mainfrom
SpencerJung:fix/7407-oauth-cancel-handling
Open

fix(examples): handle OAuth access_denied in auth-headless example#7437
SpencerJung wants to merge 1 commit into
refinedev:mainfrom
SpencerJung:fix/7407-oauth-cancel-handling

Conversation

@SpencerJung
Copy link
Copy Markdown

fix(examples): handle OAuth access_denied in auth-headless example

Description

When a user cancels GitHub OAuth login by clicking "Cancel" on the GitHub authorization screen, the callback URL contains error=access_denied. Previously, the authProvider did not handle this case, resulting in a generic "No user information from OAuth provider" 401 Unauthorized error.

This PR adds handling for the access_denied error in the auth-headless example's authProvider check method. Now when a user cancels OAuth, they see a friendly error message: "Login cancelled by user" / "Authorization denied".

Changes

  • Updated examples/auth-headless/src/App.tsx
  • Added OAuth cancellation detection in authProvider.check()
  • Returns user-friendly error message when error=access_denied is detected in URL

Testing

  1. Navigate to login page
  2. Click "Sign in with GitHub"
  3. On GitHub authorization screen, click "Cancel"
  4. Verify that a user-friendly error message is displayed instead of 401

Related Issue

Closes #7407

When a user cancels GitHub OAuth login, the callback URL contains
	error=access_denied. The authProvider's check method now detects
this and returns a user-friendly error message instead of a generic
401 Unauthorized response.

Closes refinedev#7407
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

⚠️ No Changeset found

Latest commit: 9383f92

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

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

Successfully merging this pull request may close these issues.

[BUG] Improve handling of cancelled GitHub OAuth login (shows 401 instead of user-friendly message)

1 participant