Fix OAuth token conflict - remove duplicate token creation#417
Merged
ngjunsiang merged 1 commit intoweeklyfrom Apr 7, 2026
Merged
Fix OAuth token conflict - remove duplicate token creation#417ngjunsiang merged 1 commit intoweeklyfrom
ngjunsiang merged 1 commit intoweeklyfrom
Conversation
- Remove token creation from verify_login_and_redirect - This endpoint should only create authorization codes - /token endpoint is now the single source of truth for token creation - Fixes PostgreSQL unique constraint violation on token_id Fixes #416 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fixes the OAuth sign-in flow that was creating duplicate campus tokens, causing PostgreSQL unique constraint violations.
Problem
The
verify_login_and_redirectendpoint was creating campus tokens, and then the/tokenendpoint was also creating tokens. This resulted in duplicatetoken_idvalues, violating the PostgreSQL unique constraint.Solution
verify_login_and_redirect: This endpoint now ONLY creates authorization codes for apps to exchange/tokenendpoint to handle missing credentials: Previously, if credentials didn't exist, it would raiseNotFoundError. Now it creates new credentials properly.Changes
resources.credentials[PROVIDER][user].new()call fromverify_login_and_redirect/tokento handleNotFoundErrorwhen credentials don't exist/tokenendpointTesting
Fixes #416
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com