fix(auth): distinguish OAuth access denials - #3010
Open
postoso wants to merge 1 commit into
Open
Conversation
Route explicit access_denied provider responses to a dedicated localized login message while preserving the generic fallback for other OAuth failures. Reuse the 23 locale strings from Chainlit#2970 and cover both callback variants and rendered messages. Co-Authored-By: OpenAI Codex <noreply@openai.com>
postoso
requested review from
asvishnyakov,
hayescode and
sandangel
as code owners
August 3, 2026 23:59
4 tasks
Contributor
There was a problem hiding this comment.
1 issue found across 27 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/chainlit/server.py">
<violation number="1" location="backend/chainlit/server.py:674">
P3: OAuth provider-error mapping is now duplicated in both callback handlers, which can drift if one flow is updated later and the other is missed. A shared helper for mapping provider errors to login error keys would keep both redirect variants consistent.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| if error: | ||
| logger.warning("OAuth provider %s returned error: %s", provider_id, error) | ||
| return _get_oauth_redirect_error(request, "oauthSignin") | ||
| error_key = "oauthAccessDenied" if error == "access_denied" else "oauthSignin" |
Contributor
There was a problem hiding this comment.
P3: OAuth provider-error mapping is now duplicated in both callback handlers, which can drift if one flow is updated later and the other is missed. A shared helper for mapping provider errors to login error keys would keep both redirect variants consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/chainlit/server.py, line 674:
<comment>OAuth provider-error mapping is now duplicated in both callback handlers, which can drift if one flow is updated later and the other is missed. A shared helper for mapping provider errors to login error keys would keep both redirect variants consistent.</comment>
<file context>
@@ -671,7 +671,8 @@ async def oauth_callback(
if error:
logger.warning("OAuth provider %s returned error: %s", provider_id, error)
- return _get_oauth_redirect_error(request, "oauthSignin")
+ error_key = "oauthAccessDenied" if error == "access_denied" else "oauthSignin"
+ return _get_oauth_redirect_error(request, error_key)
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
access_deniedtooauthAccessDeniedin both OAuth callback handlers.oauthSigninfallback.Testing
uv run --project backend pytest backend/tests/test_server.py backend/tests/test_translations.py(99 passed)pnpm exec cypress run --spec cypress/e2e/oauth_auth/spec.cy.ts --browser electron(4 passed)Depends on #2955. Addresses #2956.
Summary by cubic
Show a specific, localized login message when OAuth is cancelled or access is denied, and keep the generic message for other failures. Updates both OAuth callback paths and all locales to match Linear #2956.
access_deniedtooauthAccessDeniedinoauth_callbackandoauth_azure_hf_callback; keepoauthSigninfor other errors.oauthAccessDeniedto 23 locale files.Written for commit 923e175. Summary will update on new commits.