メインコンテンツまでスキップ
バージョン: 0.15.0 (最新)

📐 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 で使用するフィンガープリント値。

googleOauthSchema と lineOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature。

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

purposeQueryParameter​

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

googleOauthSchema、lineOauthSchema、twitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute、twitterOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature、twitterOAuthFeature。

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

redirectUrlQueryParameter​

定義
場所フィールド型必須制約
クエリredirectUrl文字列はいコールバック先。generateRedirectURL はパーセントエンコーディングを保持して onetimeToken を追加します。

このパラメータースキーマが要求するのは文字列であり、オリジンの検証はルートハンドラーが行います。Google、LINE、Twitter の開始ルートは、プロバイダー state の準備やドライバーの呼び出し前に、validateURL で params.requestQuery.redirectUrl を検証します。不正または許可されていない URL は 400、許可リストが未設定または空の場合は AuthenticationUnexpectedError を返し、開始ルートが 500 に対応付けます。Google、LINE、Twitter のコールバックでは、プロバイダーのコールバック処理と state の処理後、アイデンティティの検査とトークンの生成・保存より前に、validateURL が state の URL を configuration.oauth.allowedRedirectOrigins に対して検証します。URL は許可されたオリジンを持つ絶対 URL である必要があります。不正または許可されていない URL は 400、オリジンが未設定または空の場合は 500 を返します。

googleOauthSchema、lineOauthSchema、twitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute、twitterOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature、twitterOAuthFeature。

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

typeIdQueryParameter​

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

googleOauthSchema、lineOauthSchema、twitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute、twitterOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature、twitterOAuthFeature。

完全なソースを表示
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/json、maxProperties: 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/json、maxProperties: 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/json、maxProperties: 0。フィールド不可。
完全なソースを表示
export const twitterOauthSchema = withSchema({
parameters: [purposeQueryParameter, redirectUrlQueryParameter, typeIdQueryParameter],
requestBody: {content: {'application/json': {schema: {maxProperties: 0, type: 'object'}}}},
});