📐 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。完全なソースを表示
purposeQueryParameter
定義
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| クエリ | purpose | 文字列 | はい | 列挙値 oauth-login、oauth-signup。 |
googleOauthSchema、lineOauthSchema、twitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute、twitterOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature、twitterOAuthFeature。完全なソースを表示
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。完全なソースを表示
typeIdQueryParameter
定義
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| クエリ | typeId | 文字列 | いいえ | 新しい oauth-signup アイデンティティを作成する場合にのみ後で必要。 |
googleOauthSchema、lineOauthSchema、twitterOauthSchema に展開されます。ルートでの使用: googleOAuthRoute、lineOAuthRoute、twitterOAuthRoute。機能での使用: googleOAuthFeature、lineOAuthFeature、twitterOAuthFeature。完全なソースを表示
stateQueryParameter
定義
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| クエリ | state | 文字列 | はい | パブリックな再利用可能パラメーター。現在 OAuth スキーマ/機能は使用しません。 |
Google と LINE のコールバックは requestQuery.state を直接読み取ります。この宣言はそれらを検証しません。完全なソースを表示
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'}}}},
});