> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 認可

> モバイルアプリケーションおよびシングルページアプリケーションに推奨される OAuth 2.0 グラントである、PKCE を使用する認可コードフローを開始します。

export const ResponseSchema = ({statusCode, type = "{}", children}) => {
  const [open, setOpen] = useState(false);
  return <div className="border border-gray-100 dark:border-gray-800 rounded-lg mb-3 overflow-hidden">
      <div className={`flex items-center gap-2.5 px-4 py-2.5 cursor-pointer select-none ${open ? "bg-gray-50 dark:bg-gray-800" : ""}`} onClick={() => setOpen(!open)}>
        {statusCode && <span className="border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 font-mono text-xs px-1.5 py-0.5 rounded">
            {statusCode.startsWith("default") ? "default" : statusCode}
          </span>}
        <span className="text-gray-500 dark:text-gray-400 text-sm font-mono">
          {type}
        </span>
        <span className="text-gray-400 dark:text-gray-500 text-sm italic">
          application/json
        </span>
        <svg className={`ml-auto opacity-50 transition-transform duration-200 ${open ? "rotate-180" : ""}`} width="16" height="16" viewBox="0 0 16 16" fill="none">
          <path d="M4 6l4 4 4-4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
        </svg>
      </div>
      {open && <div className="px-4 pt-1 pb-3 border-t border-gray-100 dark:border-gray-800">
          {children}
        </div>}
    </div>;
};

<div id="endpoint">
  ## エンドポイント
</div>

`GET /authorize`

これは、モバイルアプリがAPIにアクセスするために使用するOAuth 2.0グラントです。このフローを開始する前に、`code_verifier` を生成して保存し、それを使って、認可リクエストで送信する `code_challenge` を生成する必要があります。

<div id="query-parameters">
  ## クエリーパラメーター
</div>

<ParamField query="audience" type="string" required>
  アクセスする対象 API の一意の識別子です。
</ParamField>

<ParamField query="resource" type="string">
  アクセスする対象 API (リソースサーバー) の識別子です。Auth0 テナントに登録されている API Identifier と一致している必要があります。テナントの [Resource Parameter Compatibility Profile](https://auth0.com/docs/get-started/tenant-settings#settings-advanced) が `compatibility` に設定されている場合は、`audience` の代わりに使用されます。
</ParamField>

<ParamField query="scope" type="string">
  認可をリクエストするスコープです。スペース区切りで指定する必要があります。標準の OpenID Connect (OIDC) スコープ、カスタムクレーム、または対象 API でサポートされている任意のスコープをリクエストできます。リフレッシュトークンを取得するには、`offline_access` を含めてください。
</ParamField>

<ParamField query="response_type" type="string" required>
  実行する OAuth 2.0 フローを Auth0 に示します。認可コードグラント (PKCE) フローには `code` を使用します。

  使用可能な値: `code`
</ParamField>

<ParamField query="client_id" type="string" required>
  アプリケーションのクライアントIDです。
</ParamField>

<ParamField query="state" type="string">
  クライアントが最初のリクエストに追加し、クライアントにリダイレクトする際に Auth0 が含める不透明な値です。この値は、CSRF 攻撃を防ぐためにクライアントが使用する必要があります。
</ParamField>

<ParamField query="redirect_uri" type="string">
  ユーザーが認可を付与した後に、Auth0 がブラウザーをリダイレクトする先の URL です。
</ParamField>

<ParamField query="code_challenge_method" type="string" required>
  チャレンジの生成に使用する方式です。Auth0 ではこの方式のみがサポートされるため、`S256` を使用します。

  使用可能な値: `S256`
</ParamField>

<ParamField query="code_challenge" type="string" required>
  `code_verifier` から生成されたチャレンジです。
</ParamField>

<ParamField query="connection" type="string">
  アプリケーションに設定されている接続の名前です。
</ParamField>

<ParamField query="prompt" type="string">
  サイレント認証リクエストを開始するには、`prompt=none` を使用します。
</ParamField>

<ParamField query="organization" type="string">
  ユーザーの認証時に使用する組織の ID です。
</ParamField>

<ParamField query="invitation" type="string">
  組織への招待のチケット ID です。
</ParamField>

<ParamField query="dpop_jkt" type="string">
  SHA-256 ハッシュ関数を使用した、proof-of-possession 公開鍵の JWK Thumbprint [RFC7638](https://www.rfc-editor.org/rfc/rfc7638.html) です。
</ParamField>

<div id="response-schema">
  ## レスポンススキーマ
</div>

<ResponseSchema statusCode="default error">
  <ResponseField name="error" type="string">
    エラーコード。
  </ResponseField>

  <ResponseField name="error_description" type="string">
    エラーの説明。
  </ResponseField>
</ResponseSchema>

<div id="response-messages">
  ## レスポンスメッセージ
</div>

| Status  | Description                          |
| ------- | ------------------------------------ |
| 302     | 認可後、指定された redirect\_uri にリダイレクトされます。 |
| default | 予期しないエラー                             |
