Skip to content

fix(auth): create OAuth client auth lazily so empty secrets don't crash module load - #1053

Merged
flipvh merged 1 commit into
mainfrom
fix/oauth-client-secret-lazy
Aug 14, 2026
Merged

fix(auth): create OAuth client auth lazily so empty secrets don't crash module load#1053
flipvh merged 1 commit into
mainfrom
fix/oauth-client-secret-lazy

Conversation

@flipvh

@flipvh flipvh commented Aug 14, 2026

Copy link
Copy Markdown
Member

Why

The release-please PR (#1044) fails CI at the "Generate OpenAPI spec" step: TypeError: "clientSecret" must not be empty. Regression from #1052oauth4webapi's ClientSecretPost validates eagerly (arctic's constructors accepted empty strings), and providers.ts called it at module load. Any context without OAuth secrets crashes on import: CI openapi generation, and any fork/deployment booting without all three providers configured.

What

Move the ClientSecretPost call inside validateAuthorizationCode. A missing secret now fails only that provider's code exchange (mapped to oauth_failed), which matches pre-migration behavior. No other behavior change.

Test plan

  • Reproduced CI's failure locally: generate:openapi with empty *_CLIENT_SECRET env fails on main's code, passes with this fix
  • backend type-check + oauth sign-in tests (18) pass

🤖 Generated with Claude Code

…sh module load

oauth4webapi's ClientSecretPost rejects empty secrets, unlike arctic's
constructors. providers.ts called it at module load, so any context
without OAuth secrets (CI openapi generation on the release PR, forks
or deployments without a provider configured) crashed on import.
Construct it inside validateAuthorizationCode instead: a missing secret
now fails only that provider's code exchange, matching pre-migration
behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@flipvh
flipvh merged commit 960c00f into main Aug 14, 2026
9 checks passed
@flipvh
flipvh deleted the fix/oauth-client-secret-lazy branch August 14, 2026 10:12
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