メインコンテンツまでスキップ
バージョン: 🚧 Canary

📐 OAuth schemas

OAuth exports five reusable OpenAPI query parameters and three initiation schemas. Callback routes compose no schema, including for their state query.

Inventory​

ExportRequest locationContract
fpQueryParameterQueryRequired string fp.
purposeQueryParameterQueryRequired oauth-login or oauth-signup.
redirectUrlQueryParameterQueryRequired string redirectUrl.
typeIdQueryParameterQueryOptional string typeId.
stateQueryParameterQueryRequired string state; currently uncomposed.
googleOauthSchemaQuery, bodyGoogle initiation parameters and an empty JSON object body.
lineOauthSchemaQuery, bodyLINE initiation parameters and an empty JSON object body.
twitterOauthSchemaQuery, bodyTwitter initiation parameters and an empty JSON object body.

Details​

fpQueryParameter​

Definition
LocationFieldTypeRequiredConstraints
QueryfpstringYesFingerprint value used in Google and LINE state.

Spread by googleOauthSchema and lineOauthSchema. Used by route: googleOAuthRoute and lineOAuthRoute. Used by feature: googleOAuthFeature and lineOAuthFeature.

View complete source
export const fpQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'fp',
required: true,
schema: {type: 'string'},
};

purposeQueryParameter​

Definition
LocationFieldTypeRequiredConstraints
QuerypurposestringYesEnum oauth-login, oauth-signup.

Spread by googleOauthSchema, lineOauthSchema, and twitterOauthSchema. Used by route: googleOAuthRoute, lineOAuthRoute, and twitterOAuthRoute. Used by feature: googleOAuthFeature, lineOAuthFeature, and twitterOAuthFeature.

View complete source
export const purposeQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'purpose',
required: true,
schema: {enum: [OAUTH_LOGIN, OAUTH_SIGNUP], type: 'string'},
};

redirectUrlQueryParameter​

Definition
LocationFieldTypeRequiredConstraints
QueryredirectUrlstringYesCallback destination; generateRedirectURL preserves its percent encoding and appends onetimeToken.

This parameter schema requires a string; origin validation is performed by the route handler. Google, LINE, and Twitter initiation routes check params.requestQuery.redirectUrl with validateURL before preparing provider state or calling the driver. Malformed/disallowed URLs return 400; missing/empty allowlists return AuthenticationUnexpectedError, mapped to 500 by the initiation route. During the Google, LINE, or Twitter callback, validateURL checks the state's URL against configuration.oauth.allowedRedirectOrigins after provider callback/state processing and before identity checks, token generation, or storage. The URL must be absolute with an allowed origin: malformed/disallowed URLs return 400, and missing/empty origins return 500.

Spread by googleOauthSchema, lineOauthSchema, and twitterOauthSchema. Used by route: googleOAuthRoute, lineOAuthRoute, and twitterOAuthRoute. Used by feature: googleOAuthFeature, lineOAuthFeature, and twitterOAuthFeature.

View complete source
export const redirectUrlQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'redirectUrl',
required: true,
schema: {type: 'string'},
};

typeIdQueryParameter​

Definition
LocationFieldTypeRequiredConstraints
QuerytypeIdstringNoRequired later only when a new oauth-signup identity is created.

Spread by googleOauthSchema, lineOauthSchema, and twitterOauthSchema. Used by route: googleOAuthRoute, lineOAuthRoute, and twitterOAuthRoute. Used by feature: googleOAuthFeature, lineOAuthFeature, and twitterOAuthFeature.

View complete source
export const typeIdQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'typeId',
required: false,
schema: {type: 'string'},
};

stateQueryParameter​

Definition
LocationFieldTypeRequiredConstraints
QuerystatestringYesPublic reusable parameter; no OAuth schema or feature currently uses it.

Google and LINE callbacks read requestQuery.state directly; this declaration does not validate them.

View complete source
export const stateQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'state',
required: true,
schema: {type: 'string'},
};

googleOauthSchema​

Definition

Used by route: googleOAuthRoute. Used by feature: googleOAuthFeature.

LocationFieldTypeRequiredConstraints
QueryfpstringYesShared parameter.
QuerypurposestringYesShared enum.
QueryredirectUrlstringYesShared parameter.
QuerytypeIdstringNoShared parameter.
Body—objectNoapplication/json, maxProperties: 0; no fields allowed.
View complete source
export const googleOauthSchema = withSchema({
parameters: [fpQueryParameter, purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});

lineOauthSchema​

Definition

Used by route: lineOAuthRoute. Used by feature: lineOAuthFeature.

LocationFieldTypeRequiredConstraints
QueryfpstringYesShared parameter.
QuerypurposestringYesShared enum.
QueryredirectUrlstringYesShared parameter.
QuerytypeIdstringNoShared parameter.
Body—objectNoapplication/json, maxProperties: 0; no fields allowed.
View complete source
export const lineOauthSchema = withSchema({
parameters: [fpQueryParameter, purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});

twitterOauthSchema​

Definition

Used by route: twitterOAuthRoute. Used by feature: twitterOAuthFeature.

LocationFieldTypeRequiredConstraints
QuerypurposestringYesShared enum.
QueryredirectUrlstringYesShared parameter.
QuerytypeIdstringNoShared parameter.
Body—objectNoapplication/json, maxProperties: 0; no fields allowed.
View complete source
export const twitterOauthSchema = withSchema({
parameters: [purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});