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

# 同意の署名鍵を登録する

> 認証済みユーザーの同意の署名鍵を登録します。この鍵は、署名付き同意決定の検証に使用されます。公開鍵のみを提供します。対応する秘密鍵はデバイス外に出してはなりません。



## OpenAPI

````yaml docs/ja-jp/oas/myaccount/myaccount-api-oas.json POST /consent-signing-keys
openapi: 3.1.0
info:
  title: My Account
  version: '1.0'
  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 は次の application API access policies で作成されます。


    `require_client_grant` はユーザーフロー用


    `deny_all` はクライアント（machine-to-machine）フロー用


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


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


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


    :::info サポートされているフロー


    My Account API へのクライアントアクセス用の application API policy
    は更新できません。つまり、クライアント認証情報フローを使用して My Account API にアクセスすることはできません。


    :::


    application API access policies と、それに関連付けられた client grants
    の管理方法について詳しくは、[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}"}'
    ```
servers:
  - url: https://{host}/me/v1
    variables:
      host:
        default: auth0.auth0.com
        description: カスタムまたは標準のホスト名
security: []
tags:
  - name: factors
    description: 認証要素
    x-displayName: Factors
  - name: connected-accounts
    description: Connected Accounts
    x-displayName: Connected Accounts
  - name: authentication-methods
    description: 認証方法
    x-displayName: Authentication Methods
  - name: consents
    description: 同意
    x-displayName: Consents
  - name: organizations
    description: Organizations
    x-displayName: Organizations
  - name: profile
    description: プロフィール
    x-displayName: Profile
paths:
  /consent-signing-keys:
    post:
      tags:
        - consents
      summary: 同意の署名鍵を登録する
      description: >-
        認証済みユーザーの同意の署名鍵を登録します。この鍵は、署名付き同意決定の検証に使用されます。公開鍵のみを提供します。対応する秘密鍵はデバイス外に出してはなりません。
      operationId: createConsentSigningKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConsentSigningKeyRequestContent'
        required: true
      responses:
        '201':
          $ref: '#/components/responses/CreateConsentSigningKeyResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - Bearer-DPoP:
            - create:me:consent_signing_keys
      x-codeSamples: []
components:
  schemas:
    CreateConsentSigningKeyRequestContent:
      description: 同意署名鍵を登録するためのリクエスト本文。
      type: object
      properties:
        jwk:
          $ref: '#/components/schemas/ConsentSigningKeyJwkRequest'
        device_identifier:
          type: string
          description: >-
            対応する秘密鍵を保持するデバイスの人が判読できるラベル。これは単なるラベルであり、鍵がそのデバイスに紐付いていることを保証するものではありません。
          minLength: 1
          maxLength: 128
        expires_at:
          type: string
          format: date-time
          description: >-
            鍵の有効期限日時。任意で、省略時は最長の2年間になります。現在から少なくとも1時間後であり、デフォルトの有効期限を超えない必要があります。
      required:
        - jwk
        - device_identifier
      additionalProperties: false
    ConsentSigningKeyJwkRequest:
      description: >-
        同意決定への署名用に登録する公開JWK。想定されるアルゴリズムはES256（ECDSA
        P-256）ですが、RS256およびPS256も受け入れられます。指定できるのは公開鍵の情報のみで、鍵識別子はAuth0によって割り当てられます。
      type: object
      oneOf:
        - $ref: '#/components/schemas/ConsentSigningKeyEcJwkRequest'
          title: ec
        - $ref: '#/components/schemas/ConsentSigningKeyRsaJwkRequest'
          title: rsa
      discriminator:
        propertyName: kty
        mapping:
          EC: '#/components/schemas/ConsentSigningKeyEcJwkRequest'
          RSA: '#/components/schemas/ConsentSigningKeyRsaJwkRequest'
        x-openapi-typescript-ignore: true
    ConsentSigningKey:
      type: object
      description: 認証済みユーザーが登録した同意署名鍵。
      properties:
        kid:
          type: string
          description: 登録済み署名鍵の一意の識別子。同意決定に署名する際にこれを指定すると、この鍵を使用して署名を検証できます。
          example: csk_72jbvv7LfRKYp59gtRLtkn
        jwk:
          $ref: '#/components/schemas/ConsentSigningKeyJwk'
        device_identifier:
          type: string
          description: 対応する秘密鍵を保持するデバイスの人が判読できるラベル。
        created_at:
          type: string
          format: date-time
          description: 署名鍵が登録された日時。
        expires_at:
          type: string
          format: date-time
          description: 署名鍵の有効期限日時。この時点以降、この鍵は同意決定への署名には使用できなくなり、置き換える必要があります。
      required:
        - kid
        - jwk
        - device_identifier
        - created_at
        - expires_at
      additionalProperties: false
    ErrorResponse:
      properties:
        type:
          type: string
        status:
          type: number
        title:
          type: string
        detail:
          type: string
        validation_errors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      required:
        - type
        - status
        - title
        - detail
      type: object
      additionalProperties: false
    ConsentSigningKeyEcJwkRequest:
      type: object
      description: >-
        同意決定への署名用に登録する公開ECDSA P-256
        JWK。秘密鍵の情報を指定してはなりません。鍵識別子はAuth0によって割り当てられるため、指定してはなりません。
      properties:
        kty:
          type: string
          description: 鍵タイプ。楕円曲線。
          const: EC
        crv:
          type: string
          description: 鍵が定義される曲線。P-256のみサポートされています。
          const: P-256
        alg:
          type: string
          description: 鍵で使用するアルゴリズム。
          const: ES256
        use:
          type: string
          description: 鍵の使用目的。鍵は署名鍵である必要があります。
          const: sig
        x:
          type: string
          description: 公開鍵のbase64urlエンコードされたx座標。
          pattern: ^[A-Za-z0-9_-]{43}$
        'y':
          type: string
          description: 公開鍵のbase64urlエンコードされたy座標。
          pattern: ^[A-Za-z0-9_-]{43}$
      required:
        - kty
        - crv
        - alg
        - use
        - x
        - 'y'
      additionalProperties: false
    ConsentSigningKeyRsaJwkRequest:
      type: object
      description: >-
        同意決定への署名用に登録する公開RSA
        JWK。秘密鍵の情報を指定してはなりません。鍵識別子はAuth0によって割り当てられるため、指定してはなりません。RSA鍵もサポートされていますが、ハードウェアに紐付くデバイス鍵としては一般的ではないため、ES256を推奨します。
      properties:
        kty:
          type: string
          description: 鍵タイプ。RSA。
          const: RSA
        alg:
          $ref: '#/components/schemas/ConsentSigningKeyRsaAlgorithmEnum'
        use:
          type: string
          description: 鍵の使用目的。鍵は署名鍵である必要があります。
          const: sig
        'n':
          type: string
          description: >-
            公開鍵のbase64urlエンコードされたモジュラス。2048ビットのモジュラスは342文字、4096ビットのモジュラスは683文字にエンコードされます。このサービスでは、1000を超える範囲指定の繰り返しを拒否するRE2でパターンをコンパイルするため、上限はconsents-apiの1400ではなく1000です。1000でも4096ビットを大幅に超えるモジュラスを受け入れられます。
          pattern: ^[A-Za-z0-9_-]{342,1000}$
        e:
          type: string
          description: 公開鍵のbase64urlエンコードされた公開指数。
          pattern: ^[A-Za-z0-9_-]{1,16}$
      required:
        - kty
        - alg
        - use
        - 'n'
        - e
      additionalProperties: false
    ConsentSigningKeyJwk:
      description: Auth0 が割り当てた鍵識別子を含む、同意決定に署名するために使用する登録済みの公開 JWK。
      type: object
      oneOf:
        - $ref: '#/components/schemas/ConsentSigningKeyEcJwk'
          title: ec
        - $ref: '#/components/schemas/ConsentSigningKeyRsaJwk'
          title: rsa
      discriminator:
        propertyName: kty
        mapping:
          EC: '#/components/schemas/ConsentSigningKeyEcJwk'
          RSA: '#/components/schemas/ConsentSigningKeyRsaJwk'
        x-openapi-typescript-ignore: true
    ValidationError:
      type: object
      properties:
        detail:
          type: string
        field:
          type: string
        pointer:
          type: string
        source:
          type: string
      required:
        - detail
      additionalProperties: false
    ConsentSigningKeyRsaAlgorithmEnum:
      type: string
      description: 鍵で使用するRSA署名アルゴリズム。
      enum:
        - RS256
        - PS256
    ConsentSigningKeyEcJwk:
      type: object
      description: 同意決定への署名に使用される、登録済みの公開ECDSA P-256 JWK。秘密鍵の情報が保存または返却されることはありません。
      properties:
        kty:
          type: string
          description: 鍵タイプ。楕円曲線。
          const: EC
        crv:
          type: string
          description: 鍵が定義される曲線。
          const: P-256
        alg:
          type: string
          description: 鍵で使用するアルゴリズム。
          const: ES256
        use:
          type: string
          description: 鍵の使用目的。
          const: sig
        x:
          type: string
          description: 公開鍵のbase64urlエンコードされたx座標。
          pattern: ^[A-Za-z0-9_-]{43}$
        'y':
          type: string
          description: 公開鍵のbase64urlエンコードされたy座標。
          pattern: ^[A-Za-z0-9_-]{43}$
        kid:
          type: string
          description: Auth0がこの鍵に割り当てた鍵識別子。最上位の`kid`と一致します。
          minLength: 1
          maxLength: 128
      required:
        - kty
        - crv
        - alg
        - use
        - x
        - 'y'
        - kid
      additionalProperties: false
    ConsentSigningKeyRsaJwk:
      type: object
      description: 同意決定に署名するために使用する、登録済みの公開 RSA JWK。秘密鍵の情報が保存または返却されることはありません。
      properties:
        kty:
          type: string
          description: 鍵タイプ。RSA。
          const: RSA
        alg:
          $ref: '#/components/schemas/ConsentSigningKeyRsaAlgorithmEnum'
        use:
          type: string
          description: 鍵の使用目的。
          const: sig
        'n':
          type: string
          description: 公開鍵の base64url エンコードされたモジュラス。
          pattern: ^[A-Za-z0-9_-]{342,1000}$
        e:
          type: string
          description: 公開鍵の base64url エンコードされた公開指数。
          pattern: ^[A-Za-z0-9_-]{1,16}$
        kid:
          type: string
          description: Auth0 がこの鍵に割り当てた鍵識別子。最上位レベルの `kid` と一致します。
          minLength: 1
          maxLength: 128
      required:
        - kty
        - alg
        - use
        - 'n'
        - e
        - kid
      additionalProperties: false
  responses:
    CreateConsentSigningKeyResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ConsentSigningKey'
      description: 同意署名鍵が正常に登録されました
      headers:
        Location:
          $ref: '#/components/headers/ConsentSigningKeyLocationHeader'
        x-ratelimit-limit:
          $ref: '#/components/headers/XRateLimitLimitHeader'
        x-ratelimit-reset:
          $ref: '#/components/headers/XRateLimitResetHeader'
        x-ratelimit-remaining:
          $ref: '#/components/headers/XRateLimitRemainingHeader'
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: スキーマに基づく入力が無効です。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: 認証されていません。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: アクセスが禁止されています。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    UnsupportedMediaType:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: サポートされていないメディアタイプです。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    UnprocessableEntity:
      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-ratelimit-limit:
          $ref: '#/components/headers/XRateLimitLimitHeader'
        x-ratelimit-reset:
          $ref: '#/components/headers/XRateLimitResetHeader'
        x-ratelimit-remaining:
          $ref: '#/components/headers/XRateLimitRemainingHeader'
        x-auth0-error-kind:
          $ref: '#/components/headers/XAuth0ErrorKindHeader'
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
  headers:
    ConsentSigningKeyLocationHeader:
      required: true
      description: 登録済みの同意署名鍵リソースのURL。
      schema:
        type: string
        format: uri
      examples:
        create:
          summary: 新たに登録した同意署名鍵のLocation URL
          value: >-
            https://auth0.auth0.com/me/v1/consent-signing-keys/csk_72jbvv7LfRKYp59gtRLtkn
    XRateLimitLimitHeader:
      required: true
      description: 制限ウィンドウ内で許可されるリクエストの最大数
      schema:
        type: number
    XRateLimitResetHeader:
      required: true
      description: bucket が補充される予定時刻（UNIXタイムスタンプ、秒単位）
      schema:
        type: number
    XRateLimitRemainingHeader:
      required: true
      description: リクエストが拒否されるまで、現在のウィンドウ内で残っているリクエスト数
      schema:
        type: number
    CorrelationIdHeader:
      required: false
      description: リクエストで指定された検証済みの`x-correlation-id`、または指定されなかった場合は生成されたUUID v4を返します。
      schema:
        type: string
    TraceparentHeader:
      required: false
      description: >-
        新しい子スパンIDとともに受信トレースIDを返す[W3C Trace
        Context](https://www.w3.org/TR/trace-context/)ヘッダー。
      schema:
        type: string
    RetryAfterHeader:
      required: true
      description: クライアントが新しいリクエストを行う前に待機すべき秒数
      schema:
        type: number
    XAuth0ErrorKindHeader:
      description: レート制限の超過がグローバル（tenant 単位）制限であることを示す指標。
      schema:
        type: string
        const: global-rate-limit
  securitySchemes:
    Bearer-DPoP:
      type: http
      scheme: bearer
      description: Bearer トークンと DPoP トークンは、API の設定に応じてサポートされます

````