Repository navigation
Broker managed OAuth with Better Auth providers and token placeholders - #241
Merged
tnkuehne merged 1 commit intoNov 20, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | f46010b | Nov 20 2026, 01:54 PM |
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 12:00
7f5b158 to
6fae162
Compare
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 12:08
6fae162 to
8a183a9
Compare
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 12:17
8a183a9 to
a068a09
Compare
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 12:36
a068a09 to
3e4d287
Compare
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 12:56
3e4d287 to
d899c6b
Compare
Managed OAuth clients are configured per provider instead of fixed profiles. The runtime uses Better Auth's provider modules for the code exchange and refresh, checks requested and granted scopes against the operator's configuration, and returns access tokens as placeholders that the network gateway substitutes only for the client's hosts. Disconnecting revokes a grant when the client declares an RFC 7009 endpoint.
tnkuehne
force-pushed
the
feat/managed-oauth-providers
branch
from
November 20, 2026 13:53
d899c6b to
f46010b
Compare
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.
What changes
Configuration.
WIDEFLEET_OAUTHnames operator clients instead of fixed profiles:{ "origin": "https://oauth.example.com", "clients": { "github": { "provider": "github", "clientId": "…", "clientSecret": "…", "scopes": ["read:user", "user:email", "repo"], "hosts": ["https://api.github.com"] }, "google": { "provider": "google", "clientId": "…", "clientSecret": "…", "scopes": ["openid", "email", "profile", "https://www.googleapis.com/auth/gmail.readonly"], "hosts": ["https://gmail.googleapis.com"], "options": { "accessType": "offline", "prompt": "select_account consent" }, "issuer": "https://accounts.google.com", "revocationUrl": "https://oauth2.googleapis.com/revoke" } } }provideris one of Better Auth's social providers;optionsare passed to it. Callback URLs stay/oauth/callback/<client>, so registrations keyedgoogle,githubandmicrosoftkeep working. The earlier format no longer parses; hosted deployments fail before deploying until it is updated.Broker (
packages/app-runtime/src/oauth.ts):@better-auth/core/social-providers, which handle each provider's protocol details. Their logger is disabled inside the broker, because provider error responses can contain credentials.scopes, including provider defaults in the authorization URL, and refuses and revokes a token response that grants more.wft1.placeholders bound to the app, the client and itshosts. The network gateway substitutes the real token inAuthorization: Beareronly for those hosts and refuses the request otherwise.revokerevokes a grant through the client's RFC 7009revocationUrl; templates call it when a user disconnects.Templates request their scopes from the managed client and revoke on disconnect.
Not included
Tests
packages/app-runtime/src/oauth.test.ts: placeholders and their hosts, bound grants, PKCE, expiry, scope limits, revocation, invalid and earlier configuration, silent provider errors.packages/app-runtime/src/template-oauth.test.ts: Gmail, GitHub and OneDrive through the broker, with template requests leaving through the runtime gateway.apps/control-plane/tests/managed-oauth-runtime.test.ts: the GitHub template on the real loader; the provider receives real tokens while the app stores placeholders.

Confidence Score: 5/5 
The PR appears safe to merge; no new blocking defect was found.Summary
Moves managed OAuth to Better Auth providers and named operator clients.
Diagram
Reviews (7) · Last reviewed commit: "Broker managed OAuth with Better Auth pr..." · Reviewed by Greptile