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

# 接続済みアカウントの作成リクエスト

> 認証されたユーザーのアカウントを外部IDプロバイダーにリンクするための認可フローを開始します。

export const Scopes = ({scopes = []}) => {
  return <div>
      <div class="api-section-heading flex flex-col gap-y-4 w-full">
        <div class="flex items-baseline border-b pb-2.5 border-gray-100 dark:border-gray-800 w-full">
          <h4 class="api-section-heading-title flex-1 mb-0">Scopes</h4>
          <div class="flex items-center"></div>
        </div>
      </div>
      <div class="mt-4">
        <div class="space-y-4 whitespace-normal prose prose-sm prose-gray dark:prose-invert overflow-wrap-anywhere [&_*]:overflow-wrap-anywhere">
          <p class="whitespace-pre-line text-xs">
            {"スコープは、APIリクエストと認証トークンの権限およびアクセスレベルを定義します。"}
          </p>
        </div>
      </div>
      <div class="flex font-mono text-sm group/param-head param-head break-all relative mt-6" id="scopes-scopes">
        <div class="flex-1 flex flex-col content-start py-0.5 mr-5">
          <div class="flex items-center flex-wrap gap-2">
            <div class="absolute -top-1.5">
              <a href="#scopes-scopes" class="-ml-10 flex items-center opacity-0 border-0 group-hover/param-head:opacity-100 focus:opacity-100 focus:outline-0 py-2 [.expandable-content_&]:-ml-[2.1rem] group/link" aria-label="見出しに移動">
                ​
                <div class="w-6 h-6 rounded-md flex items-center justify-center shadow-sm text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light">
                  <svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512">
                    <path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path>
                  </svg>
                </div>
              </a>
            </div>
            {scopes.map((scope, index) => {
    return <span class="flex items-center px-2 py-0.5 rounded-md bg-gray-100/50 dark:bg-white/5 text-gray-600 dark:text-gray-200 font-medium break-all" style={{
      lineHeight: "1rem",
      fontSize: "0.75rem",
      fontFamily: 'var(--font-jetbrains-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
    }} data-component-part="field-info-pill" key={index}>
                  {scope}
                </span>;
  })}
          </div>
        </div>
      </div>
    </div>;
};

export const ApiReleaseLifecycle = ({releaseLifecycle = "GA"}) => {
  const lifecycleMap = {
    ea: "早期アクセス",
    ga: "一般提供",
    deprecated: "非推奨",
    planned: "計画中",
    beta: "ベータ"
  };
  const LIFECYCLE_THEMES = {
    info: {
      light: {
        bg: "lab(91.896% .077188 -6.94053)",
        text: "lab(36.091% 25.9241 -68.0384)"
      },
      dark: {
        bg: "lab(16.0426% 6.71726 -27.2409)",
        text: "lab(72.6029% 4.08953 -41.9669)"
      }
    },
    secondary: {
      light: {
        bg: "lab(90.8548% 11.3355 8.01476)",
        text: "lab(47.5286% 56.4238 43.4706)"
      },
      dark: {
        bg: "lab(16.3609% 37.191 25.6346)",
        text: "lab(71.881% 41.5 29.4839)"
      }
    },
    danger: {
      light: {
        bg: "lab(94.7916% -.0000298023 0)",
        text: "lab(54.3656% 0 -.0000119209)"
      },
      dark: {
        bg: "lab(13.232% 0 0)",
        text: "lab(51.6164% 0 0)"
      }
    }
  };
  const LIFECYCLE_THEME_MAP = {
    ea: "info",
    ga: "info",
    beta: "info",
    deprecated: "secondary",
    planned: "danger"
  };
  const lifecycle = releaseLifecycle.toLocaleLowerCase();
  const lifecycleText = lifecycleMap[lifecycle];
  if (!lifecycleText) {
    return null;
  }
  const theme = LIFECYCLE_THEMES[LIFECYCLE_THEME_MAP[lifecycle]];
  return <div>
      <div className="api-section-heading flex flex-col gap-y-4 w-full">
        <div className="flex items-baseline border-b pb-2.5 border-gray-100 dark:border-gray-800 w-full">
          <h4 className="api-section-heading-title flex-1 mb-0">リリースライフサイクル</h4>
        </div>
      </div>
      <div className="flex font-mono text-sm group/param-head param-head break-all relative mt-2.5" id="releaselifecycle-lifecycle">
        <div className="flex-1 flex flex-col content-start py-0.5 mr-5">
          <div className="flex items-center flex-wrap gap-2">
            <div className="absolute -top-1.5">
              <a href="#releaselifecycle-lifecycle" className="-ml-10 flex items-center opacity-0 border-0 group-hover/param-head:opacity-100 focus:opacity-100 focus:outline-0 py-2 [.expandable-content_&]:-ml-[2.1rem] group/link" aria-label="ヘッダーに移動">
                <div className="w-6 h-6 rounded-md flex items-center justify-center shadow-sm text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light">
                  <svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512">
                    <path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path>
                  </svg>
                </div>
              </a>
            </div>
            <span className="inline-flex items-center w-fit font-medium gap-1 py-0.5 px-2 rounded-md" style={{
    lineHeight: "1rem",
    fontSize: "0.75rem",
    fontFamily: 'var(--font-jetbrains-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
    backgroundColor: `light-dark(${theme.light.bg}, ${theme.dark.bg})`,
    color: `light-dark(${theme.light.text}, ${theme.dark.text})`,
    borderColor: `light-dark(color-mix(in oklab, ${theme.light.text} 25%, transparent), color-mix(in oklab, ${theme.dark.text} 25%, transparent))`
  }}>
              {lifecycleText}
            </span>
          </div>
        </div>
      </div>
    </div>;
};

<ApiReleaseLifecycle releaseLifecycle="GA" />

<Scopes scopes={["create:me:connected_accounts"]} />


## OpenAPI

````yaml ja/docs/oas/myaccount/myaccount-api-oas.json POST /connected-accounts/connect
openapi: 3.1.0
info:
  description: >-
    Auth0 My Account API
    には、ユーザーが自身のアカウント情報を管理するための専用エンドポイントのセットが用意されています。お客様は、これらの API
    を使用してアプリケーション内にセルフサービス機能を構築したり、ユーザーアカウントの詳細情報を段階的に追加したりできます。


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


    :::tip Auth0 ドメインとカスタムドメインの使い分け


    My Account API では、正規の Auth0
    ドメインまたはカスタムドメインを使用できますが、次の各処理を含むプロセス全体を通して、同じドメインを使用する必要があります。


    - アクセストークンの取得

    - audience 値の設定

    - My Account API エンドポイントの呼び出し


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


    :::


    ## My Account API を有効化する


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


    1. Authentication > APIs に移動します。

    2. MyAccount API バナーを見つけます。

    3. Activate を選択します。


    ![](https://images.ctfassets.net/cdy7uua7fh8z/DGkDQNIHcegN8vtQyEvF3/a2e98b06867701a66fa1f1b3df1c996b/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
    では最小権限の原則に従い、アプリケーションが本当に必要なものにのみアクセスできるようにして、潜在的なセキュリティリスクを最小限に抑える必要があります。


    アプリケーションに最終的に付与される Permissions は、アプリケーション API
    アクセスポリシーで許可されたスコープ、エンドユーザーに割り当てられたロールベースアクセス制御（RBAC）の権限、およびユーザーの同意（該当する場合）の積集合によって決まります。


    :::info サポート対象フロー


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


    :::


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


    ## アクセストークンを取得する


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


    :::info &nbsp

    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)
    を使用することを強くお勧めします。

    :::


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


    - [Call Your API Using the Authorization Code
    Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/call-your-api-using-the-authorization-code-flow)

    - [Call Your API Using the Authorization Code Flow with
    PKCE](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)


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


    - [Call Your API Using Resource Owner Password
    Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow)

    - [Login Flow with Native Passkeys
    API](https://auth0.com/docs/native-passkeys-api#login-flow)


    ## 例


    ### 認可コードフローを使用する Universal Login


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


    ```

    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 をアクセストークンに交換する**


    ```

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


    ### ネイティブパスキーを使用する埋め込みログイン


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


    ```

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


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


    ```

    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}"}'
    ```
  title: My Account
  version: '1.0'
servers:
  - url: https://{host}/me/v1
    variables:
      host:
        default: auth0.auth0.com
        description: カスタムまたは正規のホスト名
security: []
tags:
  - description: 認証要素
    name: factors
    x-displayName: Factors
  - description: 接続済みアカウント
    name: connected-accounts
    x-displayName: Connected Accounts
  - description: 認証方法
    name: authentication-methods
    x-displayName: Authentication Methods
  - description: 同意
    name: consents
    x-displayName: Consents
paths:
  /connected-accounts/connect:
    post:
      tags:
        - connected-accounts
      summary: 接続済みアカウントリクエストを作成
      description: 認証されたユーザーのアカウントを外部IDプロバイダーにリンクするための認可フローを開始します。
      operationId: createConnectedAccountRequest
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnectedAccountsRequestContent'
        required: true
      responses:
        '201':
          $ref: '#/components/responses/CreateConnectedAccountsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - Bearer-DPoP:
            - create:me:connected_accounts
      x-codeSamples: []
components:
  schemas:
    CreateConnectedAccountsRequestContent:
      additionalProperties: false
      dependentRequired:
        code_challenge:
          - code_challenge_method
      description: アカウント接続リクエストを作成するためのリクエスト本文。
      properties:
        authorization_params:
          $ref: '#/components/schemas/AuthorizationParams'
        code_challenge:
          description: code verifier から導出された PKCE の code challenge。
          maxLength: 128
          minLength: 43
          type: string
        code_challenge_method:
          const: S256
          description: code challenge の導出に使用される方式。code_challenge が指定されている場合は必須です。
          type: string
        connection:
          description: 'アカウントをリンクする接続の名前（例: ''google-oauth2''、''facebook''）。'
          maxLength: 128
          minLength: 1
          type: string
        redirect_uri:
          description: 接続プロセスの完了後にリダイレクトする URI。
          format: uri
          maxLength: 2048
          type: string
        scopes:
          description: >-
            クライアントがIDプロバイダーに要求する権限を定義します。ユーザーを識別するために使用される標準のスコープ（例:
            'openid'、'email'、'profile'）、必要に応じてリフレッシュトークンを取得するために必要なスコープ（例:
            'offline_access'）、および保護されたリソースへのアクセスに必要なカスタムスコープを含める必要があります。
          example:
            - openid
            - offline_access
            - read:tasks
            - write:tasks
          items:
            maxLength: 255
            minLength: 1
            type: string
          maxItems: 100
          minItems: 1
          type: array
          uniqueItems: true
        state:
          description: リクエストと callback の間で state を維持するために使用される不透明な値。
          maxLength: 4096
          minLength: 1
          type: string
      required:
        - connection
        - redirect_uri
      type: object
    AuthorizationParams:
      additionalProperties: false
      description: >-
        認可リクエスト中に基盤となるIDプロバイダー（IdP）へ送信される認可パラメーターです。これらのパラメーターは、IdP
        が認可フローをどのように処理するかや、どの権限を要求するかに影響します。
      properties:
        acr_values:
          description: >-
            必要な認証レベル（例: 多要素、パスワードレス）を示す、希望する Authentication Context Class
            Reference の値を指定します。IDプロバイダー（IdP）は、これらの値に基づいて特定の保証レベルを適用する場合があります。
          maxLength: 1024
          minLength: 1
          type: string
        audience:
          description: 'アクセストークンの想定受信者を定義します。通常は、そのトークンの対象先（例: API 識別子）を示します。'
          maxLength: 512
          minLength: 1
          type: string
        display:
          $ref: '#/components/schemas/DisplayEnum'
        id_token_hint:
          description: >-
            以前に発行された id_token を IdP
            に提供します。どのユーザーを認証しているかを示したり、ログアウトリクエストを円滑にしたりするために使用できます。
          maxLength: 4096
          minLength: 1
          type: string
        login_hint:
          description: ログインフォームに事前入力するために、ユーザーの識別子（メールアドレスや username など）に関するヒントを提供します。
          maxLength: 255
          minLength: 1
          type: string
        max_age:
          description: ユーザーが最後に認証されてからの最大時間（秒）を示します。この時間を超えると、IdP はユーザーに再認証を要求します。
          maximum: 2147483647
          minimum: 0
          type: integer
        prompt:
          $ref: '#/components/schemas/PromptEnum'
        resource:
          description: >-
            クライアントがアクセスを要求しているリソースサーバーを指定します（OAuth 2.0 の Resource Indicators
            で使用）。
          maxLength: 512
          minLength: 1
          type: string
        ui_locales:
          description: 'ユーザーインターフェースの優先言語を、BCP47 言語タグの空白区切りリスト（例: ''en''、''es''、''fr''）として指定します。'
          maxLength: 100
          minLength: 2
          pattern: ^[a-zA-Z]{2}(-[a-zA-Z]{2})?(\s[a-zA-Z]{2}(-[a-zA-Z]{2})?)*$
          type: string
      title: Authorization Parameters
      type: object
    CreateConnectedAccountsResponseContent:
      additionalProperties: false
      properties:
        auth_session:
          description: 認証セッション識別子。
          maxLength: 64
          type: string
        connect_params:
          $ref: '#/components/schemas/ConnectParams'
        connect_uri:
          description: アカウント接続フローを開始するためのベース URI。
          format: uri
          type: string
        expires_in:
          description: ticket の有効期限が切れるまでの秒数。
          minimum: 1
          type: integer
      required:
        - connect_uri
        - auth_session
        - connect_params
        - expires_in
      type: object
    ErrorResponse:
      additionalProperties: false
      properties:
        detail:
          type: string
        status:
          type: number
        title:
          type: string
        type:
          type: string
        validation_errors:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      required:
        - type
        - status
        - title
        - detail
      type: object
    DisplayEnum:
      description: IdP が認証インターフェースをユーザーにどのように表示すべきかを示します。
      enum:
        - page
        - popup
        - touch
        - wap
    PromptEnum:
      description: IdP が認証または同意をユーザーに求めるかどうかを制御します。
      enum:
        - none
        - login
        - consent
        - select_account
    ConnectParams:
      additionalProperties: false
      description: connect URI で使用するパラメーター。
      properties:
        ticket:
          description: 接続 URI で使用するチケット識別子。
          type: string
      required:
        - ticket
      type: object
    ValidationError:
      additionalProperties: false
      properties:
        detail:
          type: string
        field:
          type: string
        pointer:
          type: string
        source:
          type: string
      required:
        - detail
      type: object
  responses:
    CreateConnectedAccountsResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateConnectedAccountsResponseContent'
      description: アカウント接続リクエストが正常に作成されました
      headers:
        x-ratelimit-limit:
          $ref: '#/components/headers/XRateLimitLimitHeader'
        x-ratelimit-remaining:
          $ref: '#/components/headers/XRateLimitRemainingHeader'
        x-ratelimit-reset:
          $ref: '#/components/headers/XRateLimitResetHeader'
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: スキーマに基づいて無効な入力です。
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: 認証されていません。
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: アクセスが禁止されています。
    UnsupportedMediaType:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: サポートされていないメディアタイプです。
    TooManyRequests:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: リクエストが多すぎます。
      headers:
        retry-after:
          $ref: '#/components/headers/RetryAfterHeader'
        x-auth0-error-kind:
          $ref: '#/components/headers/XAuth0ErrorKindHeader'
        x-ratelimit-limit:
          $ref: '#/components/headers/XRateLimitLimitHeader'
        x-ratelimit-remaining:
          $ref: '#/components/headers/XRateLimitRemainingHeader'
        x-ratelimit-reset:
          $ref: '#/components/headers/XRateLimitResetHeader'
  headers:
    XRateLimitLimitHeader:
      description: 制限ウィンドウ内で許可されるリクエストの最大数
      required: true
      schema:
        type: number
    XRateLimitRemainingHeader:
      description: リクエストが拒否されるまで、現在のウィンドウ内で残っているリクエスト数
      required: true
      schema:
        type: number
    XRateLimitResetHeader:
      description: バケットが補充される予定時刻（秒単位の UNIX タイムスタンプ）
      required: true
      schema:
        type: number
    RetryAfterHeader:
      description: 新しいリクエストを送信するまでにクライアントが待機すべき秒数
      required: true
      schema:
        type: number
    XAuth0ErrorKindHeader:
      description: レート制限の超過がグローバル（テナント単位の）制限であることを示す指標。
      schema:
        const: global-rate-limit
        type: string
  securitySchemes:
    Bearer-DPoP:
      description: Bearer トークンと DPoP トークンは、API の設定に応じてサポートされます
      scheme: bearer
      type: http

````