🔗 OAuth Blocks
OAuth blocks provide comprehensive functionality for integrating third-party OAuth providers into NodeBlocks services. Providers currently supported: Google, Twitter, and LINE. The design allows for expansion to other providers.
🎯 Overview
OAuth blocks are designed to:
- Support multiple OAuth providers (Google, Twitter, LINE)
- Handle OAuth initiation with secure state management
- Process OAuth callbacks and authenticate users
- Map provider profiles to identities and create or resolve accounts
- Generate secure redirect URLs with authentication tokens
- Enable flexible authentication flows for signup and login
📦 Block Types
🔍 Schemas
JSON Schema/OpenAPI definitions used to validate and describe OAuth-related endpoints:
- fpQueryParameter: Fingerprint tracking parameter
- purposeQueryParameter: Flow purpose (
oauth-login|oauth-signup) - redirectUrlQueryParameter: Client redirect URL after OAuth
- typeIdQueryParameter: Optional identity type identifier
- stateQueryParameter: OAuth callback state verifier
- googleOauthSchema: OAuth initiation schema (query-only, empty body)
- twitterOauthSchema: OAuth initiation schema (query-only, empty body)
- lineOauthSchema: OAuth initiation schema (query-only, empty body)
🔧 Blocks
Pure business logic functions for OAuth flow orchestration:
- requestGoogleOAuth: Initiate provider flow with signed state
- authenticateGoogleOAuth: Authenticate provider callback and read profile
- extractOAuthLoginState: Decode and validate OAuth state token
- verifyGoogleOAuth: Map provider profile to identity; create or resolve
- generateRedirectURL: Build redirect URL with onetime/access token
- prepareTwitterCallbackState: Build state object for Twitter callback
- requestTwitterOAuth: Initiate Twitter authentication request
- authenticateTwitterOAuth: Authenticate Twitter callback
- verifyTwitterOAuth: Map Twitter profile to identity; create or resolve
- requestLineOAuth: Initiate LINE authentication flow with state token
- authenticateLineOAuth: Authenticate LINE callback and read profile
- verifyLineOAuth: Map LINE profile to identity; create or resolve
🛣️ Routes
HTTP endpoint definitions for OAuth initiation and callbacks:
- googleOAuthRoute: GET
/auth/oauth/google— Initiate Google OAuth - googleOAuthCallbackRoute: GET
/auth/oauth/google/callback— Handle callback and redirect - twitterOAuthRoute: GET
/auth/oauth/twitter— Initiate Twitter OAuth - twitterOAuthCallbackRoute: GET
/auth/oauth/twitter/callback— Handle callback and redirect - lineOAuthRoute: GET
/auth/oauth/line— Initiate LINE OAuth - lineOAuthCallbackRoute: GET
/auth/oauth/line/callback— Handle callback and redirect
🚀 Features
Composed features that combine schemas, routes, and blocks for end-to-end OAuth flows:
- googleOAuthFeature: OAuth initiation workflow
- googleOAuthCallbackFeature: OAuth callback processing and redirect
- twitterOAuthFeature: OAuth initiation workflow
- twitterOAuthCallbackFeature: OAuth callback processing and redirect
- lineOAuthFeature: OAuth initiation workflow
- lineOAuthCallbackFeature: OAuth callback processing and redirect
🔗 Related Documentation
- OAuth Schemas - OAuth data validation and contracts
- OAuth Blocks - OAuth business logic functions
- OAuth Routes - HTTP endpoint definitions
- OAuth Features - Complete OAuth management features