🛣️ OAuth routes
OAuth routes are SDK composers, not Express middleware. Provider drivers perform browser redirects; callback routes create a one-time login token and redirect the browser.
Inventory
| Route | Method / protocol | Path | Schema | Validators | Success status |
|---|---|---|---|---|---|
googleOAuthRoute | GET / HTTP | /auth/oauth/google | googleOauthSchema | None | Driver redirect |
googleOAuthCallbackRoute | GET / HTTP | /auth/oauth/google/callback | None | None | 302 redirect |
lineOAuthRoute | GET / HTTP | /auth/oauth/line | lineOauthSchema | None | Driver redirect |
lineOAuthCallbackRoute | GET / HTTP | /auth/oauth/line/callback | None | None | 302 redirect |
twitterOAuthRoute | GET / HTTP | /auth/oauth/twitter | twitterOauthSchema | None | Driver redirect |
twitterOAuthCallbackRoute | GET / HTTP | /auth/oauth/twitter/callback | None | None | 302 redirect |
Details
googleOAuthRoute
Implementation
Endpoint: GET /auth/oauth/google
Access: Public; validators: [].
Request: googleOauthSchema validates fp, purpose, redirectUrl, optional typeId, and an optional empty JSON object.
Pipeline: validateURL → requestGoogleOAuth → orThrow.
Redirect validation: Checks params.requestQuery.redirectUrl against configuration.oauth.allowedRedirectOrigins before preparing provider state or invoking the driver. Malformed/disallowed URLs return AuthenticationInvalidInputError (400) and stop the provider request. Missing/empty origins produce AuthenticationUnexpectedError; the initiation route maps it to 500.
Success: The injected googleOAuthDriver.request handles the provider redirect.
Failure: AuthenticationInvalidTokenError and AuthenticationInvalidInputError map to 400; AuthenticationUnexpectedError maps to 500.View complete source
googleOAuthCallbackRoute
Implementation
Endpoint: GET /auth/oauth/google/callback
Access: Public; validators: [].
Request: No composed schema. The route reads provider callback data and requestQuery.state directly.
Pipeline: authenticateGoogleOAuth → extractOAuthLoginState → validateURL → signup-only checkEmailIsUniqueInIdentities → verifyGoogleOAuth → getLoginTokenTarget → getFingerprint → buildTokenVerification → generateOneTimeToken → storeOneTimeToken → generateRedirectURL → redirectTo → orThrow.
Redirect validation: After extracting the signed login state, before the signup email uniqueness check, identity resolution and token generation, validateURL checks loginState.redirectUrl against configuration.oauth.allowedRedirectOrigins. A valid absolute URL with an allowed origin is required before generating the redirect. Invalid/disallowed URLs map to AuthenticationInvalidInputError (400); undefined/empty origins map to AuthenticationUnexpectedError (500). See configuration.
Success: redirectTo sends 302 using the state's redirect URL with onetimeToken appended. generateRedirectURL preserves its percent encoding without additional decoding.
Failure: Invalid token/input is 400, no identity is 404, and database or missing-origin configuration failures are 500. A driver exception before a Result escapes to the service error handler.View complete source
lineOAuthRoute
Implementation
Endpoint: GET /auth/oauth/line
Access: Public; validators: [].
Request: lineOauthSchema validates fp, purpose, redirectUrl, optional typeId, and an optional empty JSON object.
Pipeline: validateURL → requestLineOAuth → orThrow.
Redirect validation: Checks params.requestQuery.redirectUrl against configuration.oauth.allowedRedirectOrigins before preparing provider state or invoking the driver. Malformed/disallowed URLs return AuthenticationInvalidInputError (400) and stop the provider request. Missing/empty origins produce AuthenticationUnexpectedError; the initiation route maps it to 500.
Success: The injected lineOAuthDriver.request handles the provider redirect.
Failure: AuthenticationInvalidInputError maps to 400; AuthenticationUnexpectedError maps to 500. Other errors propagate without an explicit route mapping.View complete source
lineOAuthCallbackRoute
Implementation
Endpoint: GET /auth/oauth/line/callback
Access: Public; validators: [].
Request: No composed schema; reads provider callback data and requestQuery.state.
Pipeline: authenticateLineOAuth → extractOAuthLoginState → validateURL → verifyLineOAuth → getLoginTokenTarget → getFingerprint → buildTokenVerification → generateOneTimeToken → storeOneTimeToken → generateRedirectURL → redirectTo → orThrow.
Redirect validation: After extracting the signed login state, before identity resolution and token generation, validateURL checks loginState.redirectUrl against configuration.oauth.allowedRedirectOrigins. A valid absolute URL with an allowed origin is required before generating the redirect. Invalid/disallowed URLs map to AuthenticationInvalidInputError (400); undefined/empty origins map to AuthenticationUnexpectedError (500). See configuration.
Success: 302 redirect with the generated onetimeToken. generateRedirectURL preserves the state redirect URL's percent encoding without additional decoding.
Failure: Input 400, missing identity 404, database, missing-origin configuration, or OAuth error 500; a thrown driver callback bypasses its Result wrapper.View complete source
twitterOAuthRoute
Implementation
Endpoint: GET /auth/oauth/twitter
Access: Public; validators: [].
Request: twitterOauthSchema validates purpose, redirectUrl, optional typeId, and an optional empty JSON object.
Pipeline: validateURL → prepareTwitterCallbackState → requestTwitterOAuth → orThrow.
Redirect validation: Checks params.requestQuery.redirectUrl against configuration.oauth.allowedRedirectOrigins before preparing provider state or invoking the driver. Malformed/disallowed URLs return AuthenticationInvalidInputError (400) and stop the provider request. Missing/empty origins produce AuthenticationUnexpectedError; the initiation route maps it to 500.
Success: The injected twitterOAuthDriver.request handles the provider redirect.
Failure: AuthenticationInvalidInputError maps to 400; AuthenticationUnexpectedError maps to 500. Other errors propagate without an explicit route mapping.View complete source
twitterOAuthCallbackRoute
Implementation
Endpoint: GET /auth/oauth/twitter/callback
Access: Public; validators: [].
Request: No composed schema; Twitter's driver supplies callback state.
Pipeline: authenticateTwitterOAuth → validateURL → verifyTwitterOAuth → getLoginTokenTarget → getFingerprint → buildTokenVerification → generateOneTimeToken → storeOneTimeToken → generateRedirectURL → redirectTo → orThrow.
Redirect validation: After the provider driver callback returns state and profile, before identity resolution and token generation, validateURL checks callbackResult.state.redirectUrl against configuration.oauth.allowedRedirectOrigins. A valid absolute URL with an allowed origin is required before generating the redirect. Invalid/disallowed URLs map to AuthenticationInvalidInputError (400); undefined/empty origins map to AuthenticationUnexpectedError (500). See configuration.
Success: 302 redirect with the generated onetimeToken. generateRedirectURL preserves the state redirect URL's percent encoding without additional decoding.
Failure: Input 400, missing identity 404, database, missing-origin configuration, or OAuth failure 500.View complete source