Skip to content

feat: add env:sandbox and env:live OAuth scopes#3

Open
jjmaxwell4 wants to merge 1 commit into
mainfrom
feat/oauth-env-scopes
Open

feat: add env:sandbox and env:live OAuth scopes#3
jjmaxwell4 wants to merge 1 commit into
mainfrom
feat/oauth-env-scopes

Conversation

@jjmaxwell4

Copy link
Copy Markdown

Summary

  • Adds env:sandbox and env:live to the OAuth scope definitions so clients can request environment-specific tokens
  • Includes them in ALL_SCOPES so Better Auth's oauthProvider accepts them during authorization
  • Hardens groupScopesByResource and groupAndFormatScopes to skip non-resource scopes (like env scopes) instead of crashing the consent page

Test plan

  • OAuth authorize with scope=...+env:sandbox should succeed (no invalid_scope)
  • Consent page renders without errors when env scopes are present
  • oauthTokenMiddleware resolves correct AppEnv from token scopes

Made with Cursor

Allows OAuth clients to request environment-specific scopes so the
oauthTokenMiddleware can resolve sandbox vs live context from the token.

Also hardens groupScopesByResource and groupAndFormatScopes to skip
non-resource scopes gracefully instead of crashing the consent page.

Made-with: Cursor
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.

1 participant