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

# My Account API リファレンス

> Auth0 の My Account API に関するドキュメント

<Badge>バージョン: 1.0 (現行) </Badge>

Auth0 My Account API は、ユーザーが自身のアカウント情報を管理するための専用エンドポイント群を提供します。お客様はこれらの API を使用して、アプリケーションにセルフサービス機能を実装したり、ユーザーアカウントの情報を段階的に追加したりできます。

My Account API は現在ログインしているユーザーのコンテキストで動作し、ユーザー向けアプリケーション内で直接使用できます。

<Tip>
  <p class="uppercase font-bold">Auth0 ドメインとカスタムドメインの使い分け</p>

  My Account API では、標準の Auth0 ドメインまたはカスタムドメインを使用できますが、次の項目を含め、プロセス全体を通して同じドメインを使用する必要があります。

  * アクセストークンを取得する
  * audience の値を設定する
  * My Account API エンドポイントを呼び出す

  詳細については、[Custom Domains](https://auth0.com/docs/customize/custom-domains) を参照してください。
</Tip>

<div id="activate-the-my-account-api">
  ## My Account API を有効にする
</div>

Auth0 Dashboard では、テナントの My Account API を有効化できます。

1. **Authentication > APIs** に移動します。
2. My Account API のバナーを見つけます。
3. **Activate** を選択します。

<img src="https://mintcdn.com/translations/raZlN0BXDjNonwyb/docs/images/api/myaccount/My_Account_API_-_Activate.png?fit=max&auto=format&n=raZlN0BXDjNonwyb&q=85&s=8270b723526f0d685ddd74b81bd88ddd" width="952" height="480" data-path="docs/images/api/myaccount/My_Account_API_-_Activate.png" />

デフォルトでは、My Account API は次のアプリケーション API アクセスポリシーで作成されます。

`require_client_grant` (ユーザーフロー用)

`deny_all` (クライアント (マシン間) フロー用)

アプリケーションがユーザーに代わって My Account API にアクセスするには、そのアプリケーション用のクライアントグラントを明示的に作成する必要があります。これにより、アプリケーションが要求できる最大スコープを定義できます。あるいは、ユーザーアクセスフローのポリシーを `allow_all` に変更することもできます。これにより、テナント内の任意のアプリケーションが My Account API に対して任意のスコープを要求できるようになります。

My Account API では機微な情報や操作が公開されるため、Auth0 はユーザーアクセスフローで `allow_all` を使用することを推奨していません。My Account API では最小権限の原則に従い、各アプリケーションには本当に必要なアクセス権のみを付与して、潜在的なセキュリティリスクを最小限に抑えるようにしてください。

アプリケーションに最終的に付与される権限は、アプリケーション API アクセスポリシーで許可されるスコープ、エンドユーザーに割り当てられた Role-Based Access Control (RBAC) の権限、およびユーザーの同意 (該当する場合) の積集合によって決まります。

<Note>
  <p class="uppercase font-bold">サポートされるフロー</p>

  My Account API へのクライアントアクセスに対するアプリケーション API ポリシーは更新できません。つまり、Client Credentials Flow を使用して My Account API にアクセスすることはできません。
</Note>

アプリケーション API アクセスポリシーとそれに関連付けられたクライアントグラントの管理方法の詳細については、[Application Access to APIs: Client Grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants) を参照してください。

<div id="get-an-access-token">
  ## アクセストークンを取得する
</div>

My Account API のアクセストークンは、自分の API 向けのアクセストークンを取得する場合と同じ方法で取得できます。

<Note>
  <p class="uppercase font-bold">機微な操作</p>

  My Account API で機微な操作 (認証方法の登録など) を許可する場合は、[多要素認証 (MFA) ](https://auth0.com/docs/secure/multi-factor-authentication) によって追加のセキュリティポリシーを適用するため、[step-up authentication](https://auth0.com/docs/secure/multi-factor-authentication/step-up-authentication) を使用することを強く推奨します。
</Note>

Universal Login を使用している場合は、次の記事を参照してください。

* [認可コードフローを使用して API を呼び出す](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/call-your-api-using-the-authorization-code-flow)
* [PKCE 付き認可コードフローを使用して API を呼び出す](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce)

埋め込みログインを使用している場合は、次の記事を参照してください。

* [リソース所有者パスワードフローを使用して API を呼び出す](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow)
* [Native Passkeys API を使用したログインフロー](https://auth0.com/docs/native-passkeys-api#login-flow)

<div id="examples">
  ## 例
</div>

<div id="universal-login-with-authorization-code-flow">
  ### Universal Login で認可コードフローを使用する
</div>

**ステップ 1: 認可コードをリクエストする**

```bash lines theme={null}
curl --request GET \
  --url 'https://{yourDomain}/authorize?response_type=code&client_id={yourClientId}&redirect_uri=%7ByourRedirectUri%7D&scope=create%3Ame%3Aauthentication_methods&offline_access=&audience=https%3A%2F%2F{yourDomain}%2Fme%2F'
```

**ステップ 2: code をアクセストークンに交換する**

```bash lines theme={null}
curl --request POST \
  --url 'https://{yourDomain}/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type": "authorization_code","client_id": "{yourClientId}","client_secret": "{yourClientId}","code": "{yourAuthorizationCode}","redirect_uri": "{yourRedirectUri}","audience": "{yourAudience}","scope": "create:me:authentication_methods","offline_access": ""}'
```

<div id="embedded-login-with-native-passkeys">
  ### ネイティブパスキーを使用した埋め込みログイン
</div>

**ステップ 1: ログイン用チャレンジをリクエストする**

```bash lines theme={null}
curl --request POST \
  --url 'https://{yourDomain}/passkey/challenge' \
  --header 'content-type: application/json' \
  --data '{"client_id": "{yourDomain}"}'
```

**ステップ 2: 既存ユーザーを認証する**

```bash lines theme={null}
curl --request POST \
  --url 'https://{yourDomain}/oauth/token' \
  --header 'content-type: application/json' \
  --data '{  "grant_type": "urn:okta:params:oauth:grant-type:webauthn",  "client_id": "{yourClientId}",  "scope": "create:me:authentication_methods offline_access",  "audience": "https://{yourDomain}/me/"  "auth_session": "{sessionIdFromTheFirstRequest}",  "authn_response": "{authenticatorResponse}"}'
```

<div id="rate-limits">
  ## レート制限
</div>

EA期間中、My Account API はテナント単位で毎秒 25 リクエストに制限されます。

<div id="authentication">
  ### 認証
</div>

<Tabs class="width-1/2" borderBottom>
  <Tab title="HTTP: Bearer 認証">
    API の構成に応じて、Bearer トークンと DPoP トークンがサポートされます

    |                 |        |
    | --------------- | ------ |
    | セキュリティスキームのタイプ: | http   |
    | HTTP 認証スキーム:    | bearer |
  </Tab>
</Tabs>
