> ## 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.

# ソーシャルプロバイダーのアクセストークンによる認証

> ソーシャルプロバイダーのアクセストークンでユーザーを認証するための非推奨エンドポイントです。代わりに、ブラウザー ベースのソーシャルログインを使用してください。

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>

`POST /oauth/access_token`

<Note>
  このエンドポイントはレガシー認証パイプラインの一部です。代わりに、ブラウザーを開いてソーシャル認証を行うことを推奨します。これは、[Google と Facebook が推奨している方法](https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html)です。最新の認証パイプラインの詳細については、[OIDC 準拠認証の導入](/ja/api-auth/intro)を参照してください。

  この機能は、2017 年 6 月 8 日以降、新しいテナントではデフォルトで無効になっています。詳細については、[Application Grant Types](/ja/applications/concepts/application-grant-types)を参照してください。
</Note>

ソーシャルプロバイダーのアクセストークンと `connection` を指定すると、このエンドポイントはそのプロバイダーでユーザーを認証し、アクセストークンと、必要に応じて IDトークン を含む JSON を返します。このエンドポイントは、Facebook、Google、Twitter、Weibo でのみ使用できます。

<div id="remarks">
  ### 注記
</div>

* `profile` スコープ値は、エンドユーザーのデフォルトのユーザープロファイル クレーム (`name`、`family_name`、`given_name`、`middle_name`、`nickname`、`preferred_username`、`profile`、`picture`、`website`、`gender`、`birthdate`、`zoneinfo`、`locale`、`updated_at`) へのアクセスを要求します。

* `email` スコープ値は、`email` および `email_verified` クレームへのアクセスを要求します。

<div id="learn-more">
  ### 詳細情報
</div>

* [IDプロバイダーのAPIを呼び出す](https://auth0.com/docs/authenticate/identity-providers/calling-an-external-idp-api)
* [IDプロバイダーのアクセストークン](https://auth0.com/docs/secure/tokens/access-tokens/identity-provider-access-tokens)
* [IDプロバイダーのAPIを呼び出すためのスコープ/権限を追加する](https://auth0.com/docs/authenticate/identity-providers/adding-scopes-for-an-external-idp)

<div id="body-parameters">
  ## Body パラメーター
</div>

<ParamField body="client_id" type="string" required>
  アプリケーションの `client_id`。
</ParamField>

<ParamField body="access_token" type="string" required>
  ソーシャルプロバイダーのアクセストークン。
</ParamField>

<ParamField body="connection" type="string" required>
  アプリに設定されたIDプロバイダーの名前。
</ParamField>

<ParamField body="scope" type="string">
  `openid` を使用すると IDトークン を取得でき、`openid profile email` を使用するとユーザー情報が含まれます。
</ParamField>

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

<ResponseSchema statusCode="200">
  <ResponseField name="id_token" type="string">
    IDトークン。
  </ResponseField>

  <ResponseField name="access_token" type="string">
    アクセストークン。
  </ResponseField>

  <ResponseField name="token_type" type="string">
    トークンの種類。通常は `Bearer`。
  </ResponseField>
</ResponseSchema>

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

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

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

| ステータス   | 説明          |
| ------- | ----------- |
| 200     | 認証成功時のレスポンス |
| 400     | 不正なリクエスト    |
| 401     | 未認証         |
| 403     | アクセス禁止      |
| default | 予期しないエラー    |
