Import
import {
createOAuthCallbackDispatcher,
createOAuthCallbackHandler,
createOAuthDisconnectHandler,
createOAuthInitHandler,
githubConfig,
MemoryTokenStore,
} from "veryfront/oauth";
Examples
// Create OAuth routes with pre-configured providers
import { createOAuthCallbackHandler, createOAuthInitHandler, gmailConfig } from "veryfront/oauth";
import { tokenStore } from "./persistent-token-store.ts";
// app/api/auth/gmail/route.ts
export const GET = createOAuthInitHandler(gmailConfig, {
tokenStore,
getUserId: (request) => getSessionUserId(request),
});
// app/api/auth/gmail/callback/route.ts
export const GET = createOAuthCallbackHandler(gmailConfig, { tokenStore });
Exports
Components
Functions
| Name | Description | Source |
|---|---|---|
createOAuthCallbackDispatcher | Create one callback handler shared by a fixed allowlist of logical services. | source |
createOAuthCallbackHandler | Create a callback handler for one logical OAuth service. | source |
createOAuthDisconnectHandler | Handler for create oauth disconnect. | source |
createOAuthInitHandler | Handler for create oauth init. | source |
createOAuthStatusHandler | Handler for create oauth status. | source |
Classes
Types
| Name | Description | Source |
|---|---|---|
AuthorizationUrlOptions | Options accepted by authorization URL. | source |
GetUserIdFn | Signature for resolving the authenticated user’s ID from a request. | source |
MemoryTokenStoreOptions | Options for MemoryTokenStore. | source |
OAuthCallbackDispatcherOptions | Options accepted by a shared OAuth callback dispatcher. | source |
OAuthCallbackHandlerOptions | Options accepted by oauth callback handler. | source |
OAuthDisconnectHandlerOptions | source | |
OAuthInitHandlerOptions | Options accepted by oauth init handler. | source |
OAuthProviderConfig | Configuration used by oauth provider. | source |
OAuthServiceConfig | Configuration used by oauth service. | source |
OAuthState | State for oauth. | source |
OAuthStatusHandlerOptions | source | |
OAuthTokens | Public API contract for oauth tokens. | source |
OAuthTokenSnapshot | Detached token row plus an opaque store revision. | source |
RefreshCapableTokenStore | Token store contract required for safe refresh across concurrent workers. | source |
StoredOAuthState | Persisted OAuth state row. Created when init handler starts a flow and consumed exactly once by the callback handler. | source |
TokenExchangeOptions | Options accepted by token exchange. | source |
TokenExchangeResult | Result returned from token exchange. | source |
TokenStore | TokenStore is keyed by (serviceId, userId) - tokens are per-user. | source |
Constants
| Name | Description | Source |
|---|---|---|
airtableConfig | Configuration used by airtable. | source |
asanaConfig | Configuration used by asana. | source |
bitbucketConfig | Configuration used by bitbucket. | source |
boxConfig | Configuration used by box. | source |
calendarConfig | Configuration used by calendar. | source |
clickupConfig | Configuration used by clickup. | source |
confluenceConfig | Configuration used by confluence. | source |
docsGoogleConfig | Configuration used by Google Docs. | source |
driveConfig | Configuration used by drive. | source |
figmaConfig | Configuration used by figma. | source |
freshdeskConfig | Configuration used by freshdesk. | source |
getAuthorizationUrlOptionsSchema | source | |
getOAuthProviderConfigSchema | source | |
getOAuthServiceConfigSchema | source | |
getOAuthStateSchema | State for CSRF protection and PKCE | source |
getOAuthTokensSchema | source | |
getTokenExchangeOptionsSchema | source | |
getTokenExchangeResultSchema | source | |
githubConfig | Configuration used by github. | source |
gitlabConfig | Configuration used by gitlab. | source |
gmailConfig | Configuration used by gmail. | source |
hubspotConfig | Configuration used by hubspot. | source |
intercomConfig | Configuration used by intercom. | source |
jiraConfig | Configuration used by jira. | source |
linearConfig | Configuration used by linear. | source |
mailchimpConfig | Configuration used by mailchimp. | source |
mondayConfig | Configuration used by monday. | source |
notionConfig | Configuration used by notion. | source |
oneDriveConfig | Configuration used by one drive. | source |
outlookConfig | Configuration used by outlook. | source |
pipedriveConfig | Configuration used by pipedrive. | source |
quickbooksConfig | Configuration used by quickbooks. | source |
salesforceConfig | Configuration used by salesforce. | source |
sharePointConfig | Configuration used by share point. | source |
sheetsConfig | Configuration used by sheets. | source |
shopifyConfig | Configuration used by shopify. | source |
slackConfig | Configuration used by slack. | source |
teamsConfig | Configuration used by teams. | source |
trelloConfig | Configuration used by trello. | source |
twitterConfig | Configuration used by twitter. | source |
webexConfig | Configuration used by webex. | source |
xeroConfig | Configuration used by xero. | source |
zoomConfig | Configuration used by zoom. | source |