メインコンテンツまでスキップ
バージョン: 0.13.0 (Previous)

📐 OAuth スキーマ

OAuth は再利用可能な OpenAPI クエリパラメーター 5 つと、開始用スキーマ 3 つをエクスポートします。コールバックルートは、state クエリを含めスキーマを合成しません。

一覧

エクスポートリクエストの場所契約
fpQueryParameterクエリ必須の文字列 fp
purposeQueryParameterクエリ必須の oauth-login または oauth-signup
redirectUrlQueryParameterクエリ必須の文字列 redirectUrl
typeIdQueryParameterクエリ省略可能な文字列 typeId
stateQueryParameterクエリ必須の文字列 state。現在は未合成。
googleOauthSchemaクエリ、本文Google 開始パラメーターと空の JSON オブジェクト本文。
lineOauthSchemaクエリ、本文LINE 開始パラメーターと空の JSON オブジェクト本文。
twitterOauthSchemaクエリ、本文Twitter 開始パラメーターと空の JSON オブジェクト本文。

詳細

fpQueryParameter

定義
場所フィールド必須制約
クエリfp文字列はいGoogle と LINE の state で使用するフィンガープリント値。

googleOauthSchemalineOauthSchema に展開されます。ルートでの使用: googleOAuthRoutelineOAuthRoute機能での使用: googleOAuthFeaturelineOAuthFeature

完全なソースを表示
export const fpQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'fp',
required: true,
schema: {type: 'string'},
};

purposeQueryParameter

定義
場所フィールド必須制約
クエリpurpose文字列はい列挙値 oauth-loginoauth-signup

googleOauthSchemalineOauthSchematwitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoutelineOAuthRoutetwitterOAuthRoute機能での使用: googleOAuthFeaturelineOAuthFeaturetwitterOAuthFeature

完全なソースを表示
export const purposeQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'purpose',
required: true,
schema: {enum: [OAUTH_LOGIN, OAUTH_SIGNUP], type: 'string'},
};

redirectUrlQueryParameter

定義
場所フィールド必須制約
クエリredirectUrl文字列はいコールバック先。後でデコードされ、onetimeToken を受け取ります。

googleOauthSchemalineOauthSchematwitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoutelineOAuthRoutetwitterOAuthRoute機能での使用: googleOAuthFeaturelineOAuthFeaturetwitterOAuthFeature

完全なソースを表示
export const redirectUrlQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'redirectUrl',
required: true,
schema: {type: 'string'},
};

typeIdQueryParameter

定義
場所フィールド必須制約
クエリtypeId文字列いいえ新しい oauth-signup アイデンティティを作成する場合にのみ後で必要。

googleOauthSchemalineOauthSchematwitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoutelineOAuthRoutetwitterOAuthRoute機能での使用: googleOAuthFeaturelineOAuthFeaturetwitterOAuthFeature

完全なソースを表示
export const typeIdQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'typeId',
required: false,
schema: {type: 'string'},
};

stateQueryParameter

定義
場所フィールド必須制約
クエリstate文字列はいパブリックな再利用可能パラメーター。現在 OAuth スキーマ/機能は使用しません。

Google と LINE のコールバックは requestQuery.state を直接読み取ります。この宣言はそれらを検証しません。

完全なソースを表示
export const stateQueryParameter: OpenAPIParameter = {
in: 'query',
name: 'state',
required: true,
schema: {type: 'string'},
};

googleOauthSchema

定義

ルートでの使用: googleOAuthRoute機能での使用: googleOAuthFeature

場所フィールド必須制約
クエリfp文字列はい共通パラメーター。
クエリpurpose文字列はい共通列挙値。
クエリredirectUrl文字列はい共通パラメーター。
クエリtypeId文字列いいえ共通パラメーター。
本文オブジェクトいいえapplication/jsonmaxProperties: 0。フィールド不可。
完全なソースを表示
export const googleOauthSchema = withSchema({
parameters: [fpQueryParameter, purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});

lineOauthSchema

定義

ルートでの使用: lineOAuthRoute機能での使用: lineOAuthFeature

場所フィールド必須制約
クエリfp文字列はい共通パラメーター。
クエリpurpose文字列はい共通列挙値。
クエリredirectUrl文字列はい共通パラメーター。
クエリtypeId文字列いいえ共通パラメーター。
本文オブジェクトいいえapplication/jsonmaxProperties: 0。フィールド不可。
完全なソースを表示
export const lineOauthSchema = withSchema({
parameters: [fpQueryParameter, purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});

twitterOauthSchema

定義

ルートでの使用: twitterOAuthRoute機能での使用: twitterOAuthFeature

場所フィールド必須制約
クエリpurpose文字列はい共通列挙値。
クエリredirectUrl文字列はい共通パラメーター。
クエリtypeId文字列いいえ共通パラメーター。
本文オブジェクトいいえapplication/jsonmaxProperties: 0。フィールド不可。
完全なソースを表示
export const twitterOauthSchema = withSchema({
parameters: [purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});