veryfront/oauth

Import

TypeScript
import {  createOAuthCallbackDispatcher,  createOAuthCallbackHandler,  createOAuthDisconnectHandler,  createOAuthInitHandler,  githubConfig,  MemoryTokenStore,} from "veryfront/oauth";

Examples

TypeScript
// Create OAuth routes with pre-configured providersimport { createOAuthCallbackHandler, createOAuthInitHandler, gmailConfig } from "veryfront/oauth";import { tokenStore } from "./persistent-token-store.ts"; // app/api/auth/gmail/route.tsexport const GET = createOAuthInitHandler(gmailConfig, {  tokenStore,  getUserId: (request) => getSessionUserId(request),}); // app/api/auth/gmail/callback/route.tsexport const GET = createOAuthCallbackHandler(gmailConfig, { tokenStore });

Exports

Components

NameDescriptionSource
AuthorizationUrlOptionsSchemasource
OAuthProviderConfigSchemasource
OAuthServiceConfigSchemasource
OAuthStateSchemasource
OAuthTokensSchemasource
TokenExchangeOptionsSchemasource
TokenExchangeResultSchemasource

Functions

NameDescriptionSource
createOAuthCallbackDispatcherCreate one callback handler shared by a fixed allowlist of logical services.source
createOAuthCallbackHandlerCreate a callback handler for one logical OAuth service.source
createOAuthDisconnectHandlerHandler for create oauth disconnect.source
createOAuthInitHandlerHandler for create oauth init.source
createOAuthStatusHandlerHandler for create oauth status.source
isSupersededOAuthGrantWhether a stored OAuth token carries a broad built-in grant that the active config no longer requests. Explicit grants remain valid only when the exact broad scope appears in the persisted request snapshot.source

Classes

NameDescriptionSource
MemoryTokenStoreIn-memory TokenStore keyed by (serviceId, userId).source
OAuthProviderImplement oauth provider.source
OAuthServiceImplement oauth service.source

Types

NameDescriptionSource
AuthorizationUrlOptionsOptions accepted by authorization URL.source
GetUserIdFnSignature for resolving the authenticated user's ID from a request.source
MemoryTokenStoreOptionsOptions for MemoryTokenStore.source
OAuthCallbackDispatcherOptionsOptions accepted by a shared OAuth callback dispatcher.source
OAuthCallbackHandlerOptionsOptions accepted by oauth callback handler.source
OAuthDisconnectHandlerOptionssource
OAuthInitHandlerOptionsOptions accepted by oauth init handler.source
OAuthProviderConfigConfiguration used by oauth provider.source
OAuthScopeSourceProvenance of the scope set recorded for one OAuth authorization.source
OAuthServiceConfigConfiguration used by oauth service.source
OAuthStateState for oauth.source
OAuthStatusHandlerOptionssource
OAuthTokensPublic API contract for oauth tokens.source
OAuthTokenSnapshotDetached token row plus an opaque store revision.source
RefreshCapableTokenStoreToken store contract required for safe refresh across concurrent workers.source
StoredOAuthStatePersisted OAuth state row. Created when init handler starts a flow and consumed exactly once by the callback handler.source
TokenExchangeOptionsOptions accepted by token exchange.source
TokenExchangeResultResult returned from token exchange.source
TokenStoreTokenStore is keyed by (serviceId, userId) - tokens are per-user.source

Constants

NameDescriptionSource
airtableConfigConfiguration used by airtable.source
asanaConfigConfiguration used by asana.source
bitbucketConfigConfiguration used by bitbucket.source
boxConfigConfiguration used by box.source
calendarConfigConfiguration used by calendar.source
clickupConfigConfiguration used by clickup.source
confluenceConfigConfiguration used by confluence.source
docsGoogleConfigConfiguration used by Google Docs.source
driveConfigConfiguration used by drive.source
figmaConfigConfiguration used by figma.source
freshdeskConfigConfiguration used by freshdesk.source
getAuthorizationUrlOptionsSchemasource
getOAuthProviderConfigSchemasource
getOAuthServiceConfigSchemasource
getOAuthStateSchemaState for CSRF protection and PKCEsource
getOAuthTokensSchemasource
getTokenExchangeOptionsSchemasource
getTokenExchangeResultSchemasource
githubConfigConfiguration used by GitHub.source
gitlabConfigConfiguration used by gitlab.source
gmailConfigConfiguration used by gmail.source
hubspotConfigConfiguration used by hubspot.source
intercomConfigConfiguration used by intercom.source
jiraConfigConfiguration used by jira.source
linearConfigConfiguration used by linear.source
mailchimpConfigConfiguration used by mailchimp.source
mondayConfigConfiguration used by monday.source
notionConfigConfiguration used by notion.source
oneDriveConfigConfiguration used by one drive.source
outlookConfigConfiguration used by outlook.source
pipedriveConfigConfiguration used by pipedrive.source
quickbooksConfigConfiguration used by quickbooks.source
salesforceConfigConfiguration used by salesforce.source
sharePointConfigConfiguration used by share point.source
sheetsConfigConfiguration used by sheets.source
shopifyConfigConfiguration used by shopify.source
slackConfigConfiguration used by slack.source
teamsConfigConfiguration used by teams.source
trelloConfigConfiguration used by trello.source
twitterConfigConfiguration used by twitter.source
webexConfigConfiguration used by webex.source
xeroConfigConfiguration used by xero.source
zoomConfigConfiguration used by zoom.source