Skip to content

Allow http OAuth endpoints on localhost at token exchange - #744

Draft
Nicolapps wants to merge 1 commit into
rebootfrom
nicolas/oauth-allow-http-localhost-endpoints
Draft

Nicolapps wants to merge 1 commit into
rebootfrom
nicolas/oauth-allow-http-localhost-endpoints

Conversation

@Nicolapps

@Nicolapps Nicolapps commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

A generic OAuth provider running on the developer's machine, such as a local Keycloak, could not complete a sign-in. setupOauth accepts catalog endpoints that use plain http on localhost or 127.0.0.1, but the callback's fetchRefusingRedirects only accepted https. The flow then failed at the token exchange with Refusing non-https request to http://127.0.0.1:3299/discord/token and redirected back to the app with oauth_error.

Both checks now use the same isSecureEndpoint rule: https, or plain http on localhost or 127.0.0.1. Redirects are still refused, and http on any other host is still refused.

Two new tests in components/oauth/http.test.ts cover this. A flow with a token endpoint on http://localhost and a userinfo endpoint on http://127.0.0.1 now mints a ticket (it fails on reboot). A token endpoint on plain http on another host is refused before any request goes out. The core tests, typecheck and ESLint pass.

This is part (a) of O-10. Part (b), ignoring an id_token that a plain OAuth provider sends without being asked, is in #746. Part (c), client_secret_basic, needs an API decision and isn't included.

Tracking: O-10 (Notion)

setupOauth accepts a catalog whose token and userinfo endpoints use
plain http on localhost or 127.0.0.1, but the callback then refused to
fetch them, so a provider running locally (e.g. Keycloak) could never
complete a sign-in. Both checks now share one rule.
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
auth-v2 Ready Ready Preview Oct 16, 2026 12:14am UTC
1 Skipped Deployment
Project Deployment Actions Updated
convex-auth-docs Ignored Ignored Oct 16, 2026 12:14am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – auth-v2 — d4a25206 Deployed Oct 16, 2026 by vercel[bot]
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