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

# 同意を決定する

> 認証済みユーザーの保留中の同意を承認または拒否します。`signature` と `kid` が指定されている場合、同意サービスは決定を記録する前に、ユーザーが登録した同意の署名鍵を使用して JWS 署名を検証します。



## OpenAPI

````yaml docs/ja-jp/oas/myaccount/myaccount-api-oas.json POST /consents/{consent_id}/decide
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:
  /consents/{consent_id}/decide:
    post:
      tags:
        - consents
      summary: 同意を決定する
      description: >-
        認証済みユーザーの保留中の同意を承認または拒否します。`signature` と `kid`
        が指定されている場合、同意サービスは決定を記録する前に、ユーザーが登録した同意の署名鍵を使用して JWS 署名を検証します。
      operationId: decideConsent
      parameters:
        - $ref: '#/components/parameters/PathConsentId'
        - $ref: '#/components/parameters/HeaderCorrelationId'
        - $ref: '#/components/parameters/HeaderTraceparent'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecideConsentRequestContent'
            examples:
              approve:
                summary: 同意を承認する
                value:
                  decision: approve
              approveWithSignature:
                summary: 否認防止付きで同意を承認する
                value:
                  decision: approve
                  signature: <compact JWS over the signed payload>
                  kid: csk_72jbvv7LfRKYp59gtRLtkn
              approveWithChallengeResponse:
                summary: プッシュ通知による同意要求を承認する
                value:
                  decision: approve
                  signature: <compact JWS over the signed payload>
                  kid: csk_72jbvv7LfRKYp59gtRLtkn
                  challenge_response: <challenge response JWT built by the Guardian SDK>
              deny:
                summary: 同意を拒否する
                value:
                  decision: deny
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecideConsentResponseContent'
          description: 同意決定が正常に記録されました。
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/XRateLimitLimitHeader'
            x-ratelimit-reset:
              $ref: '#/components/headers/XRateLimitResetHeader'
            x-ratelimit-remaining:
              $ref: '#/components/headers/XRateLimitRemainingHeader'
            x-correlation-id:
              $ref: '#/components/headers/CorrelationIdHeader'
            traceparent:
              $ref: '#/components/headers/TraceparentHeader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - Bearer-DPoP:
            - create:me:consents
      x-codeSamples: []
components:
  parameters:
    PathConsentId:
      in: path
      name: consent_id
      required: true
      schema:
        type: string
      description: 取得する Consent の ID
    HeaderCorrelationId:
      in: header
      name: x-correlation-id
      required: false
      schema:
        type: string
      x-sdk-ignore: true
      description: >-
        Auth0システム全体でリクエストを関連付けるために使用する、クライアントが指定する1回の操作の一意識別子です。この値はテナントログの`references.correlation_id`に表示され、レスポンスの`x-correlation-id`ヘッダーで返されます。無効または大きすぎる値は通知なく破棄され、生成されたUUID
        v4に置き換えられます。個人を特定できる情報（PII）は含めないでください。
    HeaderTraceparent:
      in: header
      name: traceparent
      required: false
      schema:
        type: string
      x-sdk-ignore: true
      description: >-
        分散トレース全体でリクエストを関連付けるために使用する[W3C Trace
        Context](https://www.w3.org/TR/trace-context/)ヘッダーです。指定された場合は受信トレースが継続され、新しい子スパンがレスポンスの`traceparent`ヘッダーで返されます。トレースIDはテナントログの`references.trace_id`にも表示されます。形式が不正な値は無視されます。
  schemas:
    DecideConsentRequestContent:
      type: object
      description: 保留中の同意リクエストに対するユーザーの決定。
      properties:
        decision:
          $ref: '#/components/schemas/ConsentDecisionEnum'
        signature:
          type: string
          description: デバイスによって生成された、署名付き同意ペイロードのコンパクト JWS シリアル化。`kid` とともに指定する必要があります。
        kid:
          type: string
          description: '`signature` の生成に使用した、登録済み同意の署名鍵のキー ID。`signature` とともに指定する必要があります。'
        challenge_response:
          type: string
          description: >-
            デバイスが Guardian SDK を使用して、同意の `challenge` から生成するチャレンジ応答
            JWT。同意要求がプッシュ通知によって開始された場合は、この JWT を送信して、関連する MFA 取引を完了します。
      required:
        - decision
      dependentRequired:
        signature:
          - kid
        kid:
          - signature
      additionalProperties: false
    DecideConsentResponseContent:
      type: object
      description: 同意決定の結果。
      properties:
        consent_id:
          type: string
          description: 同意レコードの一意の識別子。
        status:
          $ref: '#/components/schemas/ConsentDecisionStatusEnum'
      required:
        - consent_id
        - status
      additionalProperties: false
    ConsentDecisionEnum:
      type: string
      enum:
        - approve
        - deny
      description: 同意リクエストに対するユーザーの決定。
    ConsentDecisionStatusEnum:
      type: string
      enum:
        - approved
        - denied
      description: 同意の更新後のステータス。
    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
    ValidationError:
      type: object
      properties:
        detail:
          type: string
        field:
          type: string
        pointer:
          type: string
        source:
          type: string
      required:
        - detail
      additionalProperties: false
  headers:
    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
  responses:
    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'
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: 見つかりません。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Conflict:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: リクエストがリソースの現在の状態と競合しています。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    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'
  securitySchemes:
    Bearer-DPoP:
      type: http
      scheme: bearer
      description: Bearer トークンと DPoP トークンは、API の設定に応じてサポートされます

````