Skip to content

OAuth Apps, user clients and token lifecycle

Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.

Bind OAuthApp, .defaults, .VERSION, instance .type, .octokit, .on, and the operations below. Preserve the type distinction between OAuth Apps and GitHub Apps, including which flows and results support scopes, expiration and refresh tokens.

API SDK behavior
getWebFlowAuthorizationUrl; standalone oauthAuthorizationUrl Synchronous upstream URL/result, including state. The generator can choose state if absent. Offer lazy construction when generating fresh state; preserve explicit state and its returned value.
getUserOctokit Effect yielding the actual authenticated user client, preserving its constructor and plugins.
createToken, checkToken, resetToken, refreshToken, scopeToken Typed Effects. Keep credentials, authentication metadata, expiry and response envelope in their original positions.
deleteToken, deleteAuthorization Separate destructive operations with separate event/result contracts. Never replay token lifecycle operations automatically.
Standalone OAuth methods Bind getWebFlowAuthorizationUrl, exchangeWebFlowCode, createDeviceCode, exchangeDeviceCode, check/refresh/scope/reset/delete token and delete authorization with caller-supplied request.
on(nameOrNames, handler) Preserve token/authorization base events and token.created/reset/refreshed/scoped/deleted and authorization.deleted. OAuthApp exposes registration without a public removal method in this baseline.

Provide a fresh OAuthApp per scope or one long-lived dispatcher for temporary subscriptions. Attaching a new upstream listener to a shared instance on each run leaks handlers. Session state verification, redirect policy, persistence, user consent and selecting when to revoke are application responsibilities.

Check. OAuth versus GitHub App types, state propagation, code exchange, rotated credentials, callback failure, duplicate registration and shutdown during refresh. OAuthApp declarations · OAuth methods · URL generator