> ## Documentation Index
> Fetch the complete documentation index at: https://docs-staging-fix-ss-log-app-metadata-user-metadata-clarific.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ユースケース：Formsを使用して更新ポリシーフォームを構成する

> Forms for Actionsを使用して更新ポリシーフォームを構成する

<Card title="始める前に">
  1. 以下のスコープを有効にして、[マシンツーマシンアプリケーション](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps)を作成します。

  * `read:users`
  * `update:users`
  * `create:users`
  * `read:users_app_metadata`
  * `update:users_app_metadata`
  * `create:users_app_metadata`

  2. マシンツーマシンアプリケーションの資格情報を使って[Vault接続](/docs/ja-jp/customize/forms/vault)を追加します。
</Card>

Forms for Actionsは、カスタムプライバシーポリシーフローを作成し、`app_metadata`オブジェクトの下に同意を保存できるようにします。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=f0c43afd85e4e8e54b821485083b0d25" alt="Dashboard > Actions > Forms > Privacy policy use case" data-og-width="1404" width="1404" data-og-height="638" height="638" data-path="docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=280&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=f39014b1c8eeb33a4b4e5bdc8967f47f 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=560&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=31270a7ad782dc47a077f2a945be42f3 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=840&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=99f8941d9431db392355a2dfd54a8a9e 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=1100&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=e2dc730c6d186939dfe8c46318a1349c 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=1650&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=4c42ed3f87ef7328e26f9408ad409503 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6i68dMvHDTijfRmSgN1x8Q/ad900e7d4c0fb34645921435472b8684/privavy-policy-form.png?w=2500&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=64a1b83d0634b190b317fec6f3301834 2500w" />
</Frame>

以下のセクションでは、ノードとフローを使用して更新ポリシーフォームを作成する方法と、フォームを[ログイン後](/docs/ja-jp/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger)のアクションに追加する手順について説明します。

## フォームをゼロから作成する

情報を収集するためのフォームを作成するには、次の手順に従ってください。

1. **［Auth0 Dashboard］>［Actions（アクション）］>［Forms（フォーム）］** の順に選択して、フォームエディターを開きます。
2. **［Create Form（フォームを作成）］** > **［Start from scratch（初めから作成する）］** の順に選択します。

特に設定を変更しない限り、新しいフォームには開始ノード、ステップノード、および終了スクリーンノードが含まれます。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=c49b8562214fc47d607637bff0355001" alt="Dashboard > Forms > Use Cases > Form" data-og-width="1234" width="1234" data-og-height="371" height="371" data-path="docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=280&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=8cca0626ec836d7343eb77f56d41fa66 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=560&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=59567d4ed40858b6c0cd1acf72d8fece 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=840&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=a6ae3f981d17bd534884dfcfbadc5c9f 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=1100&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=d7a0b352b5433752a1b29ffab67e0896 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=1650&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=5dd3c52f3c41f20ef637f67e069c4e42 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/73vqLAC_4jzkoyCu/docs/images/ja-jp/cdy7uua7fh8z/2TZ9jSjgEcARFpULI6hz4R/a4319a1bd482f2ee5cc23100fdb2f42c/New-form-Forms-for-action-use-case.png?w=2500&fit=max&auto=format&n=73vqLAC_4jzkoyCu&q=85&s=33143a7ae72eb3b3a3b103e9de482c39 2500w" />
</Frame>

### ステップノードを構成する

ステップノードは、ユーザーに表示されるグラフィカルインターフェースです。次の手順に従って、ステップノードに[フィールド](/docs/ja-jp/customize/forms/nodes-and-components)を追加し、新しい同意の値を収集します。

1. **［Components menu（コンポーネントメニュー）］** から **［Rich text（リッチテキスト）］** フィールドを **Step（ステップ）** ノードにドラッグします。

   * **Rich text（リッチテキスト）** ：プライバシーポリシー更新の説明を入力します。
   * **［Save（保存）］** を選択します。
2. **［Legal（法務）］** フィールドを **Step（ステップ）** ノードにドラッグします。

   * **Id** ：`privacy_policies`を入力します。
   * **Required（必要）** ：チェックボックスを有効にします。
   * **Legal（法的文）** ：「`I agree to the Privacy Policy`（プライバシーポリシーに同意します）」と入力します。
   * **［Save（保存）］** を選択します。
3. **［Publish（公開）］** を選択して保存します。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=3183b601619aaf1a963b5ed8c9b0ce72" alt="Dashboard > Actions > Forms > Use case privacy policy step node" data-og-width="1404" width="1404" data-og-height="559" height="559" data-path="docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=280&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=638a749b06c01950a8052737ee99f823 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=560&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=f440b8376bacc006f2623933e7d364f6 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=840&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=0c07e21a51424035a8108443c9d0c6c1 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=1100&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=a3d1cce88b682a7d6ba6c873b83c3ac5 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=1650&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=d9a53d3a7bf67be331e17d89ce3233fe 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/SvhX15lfbE2maUdA/docs/images/ja-jp/cdy7uua7fh8z/59zFFjQjAnjogkc2QGIqqJ/0ad66b1b636544122aa4e65968b76c2c/privacy-policy-step-node.png?w=2500&fit=max&auto=format&n=SvhX15lfbE2maUdA&q=85&s=f96696da02f7ecb5b6ac53f7a613784c 2500w" />
</Frame>

### フローノードを構成する

次の手順に従って、 **Step（ステップ）** ノードの後に **Flow（フロー）** ノードを追加し、`app_metadata`を更新して認証フローを再開します。

1. フォームエディターの下にある **［Flow（フロー）］** を選択します。
2. **Step（ステップ）** ノードと **Ending Screen（終了画面）** ノードの間にある既存のリンクを削除します。
3. 新たに **［Flow（フロー）］** > **［Click to add a flow（クリックしてフローを追加する）］** > **［Create a new flow（新しいフローを作成する）］** を選択します。

   * **［Name（名前）］** フィールドに`Update app_metadata`と入力します。
   * **［Create（作成）］** を選択します。
   * **［Save（保存）］** を選択します。
4. 下の画像のように **Flow（フロー）ノード** を **Step（ステップ）** ノードと **Ending Screen（終了画面）** ノードにリンクします。
5. **［Publish（公開）］** を選択して保存します。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=91261abd1d33090eed2255b9a6264d74" alt="Dashboard > Actions > Forms > Form" data-og-width="1404" width="1404" data-og-height="599" height="599" data-path="docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=280&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=400ddaf08a1c411aac4cd07dde6e5dc9 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=560&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=da5bf23374bf57840a7c887462a7d2a2 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=840&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=e70bde45a75ac26528f6e109b7344065 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=1100&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=dd685fc10f04e769226679d500238892 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=1650&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=66fc6f045f75e5840736129cc0f04961 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/upybnyhhFhK8rkfB/docs/images/ja-jp/cdy7uua7fh8z/6YIkzm7SrpM9LW76AXuRzh/353c518fe82bbaa440836da1d83596d6/link-policies.png?w=2500&fit=max&auto=format&n=upybnyhhFhK8rkfB&q=85&s=5cf014e3929cc29d460d7f9d41df60de 2500w" />
</Frame>

Auth0ユーザーの更新アクションをフローに追加するには、次の手順に従います。

1. **［Update user\_metadata（user\_metadata更新）］* \*\*\* フロー*\* を選択してから **［Edit flow（フローの編集）］** を選択し、新しいタブにフローエディターを開きます。
2. アクションの **［Start（開始）］** の下にある **［+］** アイコンを選択し、 **Update user（ユーザー更新）** アクションを追加します。以下のフィールドに入力して、 **［Save（保存）］** を選択します。

   * **Connection（接続）** ：ドロップダウンからM2MアプリケーションへのVault接続を選択します。

   * **User ID（ユーザーID）** ：`{{context.user.user_id}}`と入力します。

   * **Body（ボディー）** ：以下のコードをコピーして貼り付け、privacy\_policiesとprivacy\_policies\_timestampのプロパティを含むapp\_metadataを更新します。

     ```text lines theme={null}
     {
       "app_metadata": {
         "privacy_policies": true,
         "privacy_policies_timestamp": "{{ functions.toTimestamp() }}"
       }
     }
     ```

   * **［Save（保存）］** を選択します。
3. **［Publish（公開）］** を選択して保存します。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=32e5ea5f32c448e97a52d7d6fad77e51" alt="Dashboard > Actions > Forms > User case privacy policy code" data-og-width="1404" width="1404" data-og-height="338" height="338" data-path="docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=280&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=78382df0fd9e39426340ffaba4262dec 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=560&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=d93d1404ba9dbd75db7d3e2e23b5ff28 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=840&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=146786ef996115c60c5fd1e0043c34b2 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=1100&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=8da9bf17bb8503644a5c71e8658ac7c1 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=1650&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=462412e3687adef3bdc459d1e7ce9c49 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/nVy5a6j9ygPkp4bC/docs/images/ja-jp/cdy7uua7fh8z/CvMNIwWrOUwaFW4X3G28p/1fb70ae57a20749d9ffaaba8dc0b7e26/update-user-privacy.png?w=2500&fit=max&auto=format&n=nVy5a6j9ygPkp4bC&q=85&s=cd89b0c9fe322d5309480ac8bc072996 2500w" />
</Frame>

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  **Update app\_metadata** フローは、`privacy_policies true`値を`app_metadata`オブジェクトに追加し、[ヘルパー関数](/docs/ja-jp/customize/forms/variables)を使ってタイムスタンプを生成します。
</Callout>

## フォームのレンダーコードを取得する

フォームのレンダーコードを取得して、カスタムのログイン後アクションでフォームを視覚的にレンダリングするには、以下の手順に従います。

* フォームエディターから **`<>`［Render（レンダー）］** を選択します。
* **［Copy（コピー）］** を選択します。

<Frame>
  <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=278cce88276b97aece279d7f6e1d985b" alt="Dashboard > Actions > Forms > Form > Embed" data-og-width="1400" width="1400" data-og-height="848" height="848" data-path="docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=280&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=b4758fbc4121f6a78b60459e0f77c0a0 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=560&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=cf66190166268a314e1e346978a5135d 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=840&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=70fa8888cf2e1aa8683c5058b91394b3 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=1100&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=f9195362a98d62728597137e72758f49 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=1650&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=f0233dfcd4b4cf6caaa6242cd497fef0 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/62QIoIQSBfS_XUi6/docs/images/ja-jp/cdy7uua7fh8z/2EIUzc539sq9lwoTKbjoJv/496a864c0fc44a782c9cadca119dbfb0/embed.png?w=2500&fit=max&auto=format&n=62QIoIQSBfS_XUi6&q=85&s=ee4e5c3b35cde980b430b2c32b25e145 2500w" />
</Frame>

## ログイン後のアクションを作成する

ログイン後のアクションを作成してフォームをレンダリングするには、次の手順に従います。

1. **［Auth0 Dashboard］>［Actions（アクション）］>［Flows（フロー）］>［Login（ログイン）］** に移動します。
2. **［+］** アイコンを選択し、 **［Build from scratch（初めから構築する）］** を選択します。

   * **Name（名前）** ：`Render Update Policy Form`（更新ポリシーフォームのレンダリング）と入力します。
   * **Trigger（トリガー）** ：［`Login / Post Login`（ログイン/ログイン後）］を選択します。
   * **Runtime（ランタイム）** ：推奨バージョンを選択します。
3. **［Create（作成）］** を選択します。

ログイン後のアクションを構成するには、以下を行います。

1. 既存のコードをコードエディターから削除します。

2. フォームのレンダリングコードをコードエディターに貼り付けます。

3. コードを編集して、フォームをレンダリングする条件ロジックを定義します。

   ```javascript lines theme={null}
   /**
   * @param {Event} event - Details about the user and the context in which they are logging in.
   * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
   */
   exports.onExecutePostLogin = async (event, api) => {
     const FORM_ID = 'REPLACE_WITH_YOUR_FORM_ID';

     if (event.user.app_metadata.privacy_policies !== true) {
       api.prompt.render(FORM_ID);
     }
   }

   exports.onContinuePostLogin = async (event, api) => { }
   ```

   <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
     上の例にあるコードでは、ユーザーのアプリメタデータに`privacy_policies`プロパティがない場合にフォームが表示されます。
   </Callout>

4. **［Deploy（デプロイ）］** を選択します。

5. **［Render Update Policy Form（更新ポリシーフォームのレンダリング）］** アクションを **Login（ログイン）** フローにドラッグ＆ドロップします。

   <Frame>
     <img src="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=228ca35e8d0deaa004bca34a30e55bcf" alt="Dashboard > Forms > Use Case > Render update policy form login action" data-og-width="1370" width="1370" data-og-height="668" height="668" data-path="docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=280&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=20570949881fb107754045dee346a254 280w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=560&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=605b02e9acf20b7c663ce045746f28d9 560w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=840&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=1f1fe4e2828de733f1e47774cb387f2a 840w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=1100&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=b45ff41d0df96f32aaf47e8d6cbaa672 1100w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=1650&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=3462fb67107bb4b563553ed9fef2a8ee 1650w, https://mintcdn.com/docs-staging-fix-ss-log-app-metadata-user-metadata-clarific/XMfCJv9jfeC0Q3L4/docs/images/ja-jp/cdy7uua7fh8z/5TOwDgevZsBqd7yZynUYWU/41ca909dc3007aed4f40ff794a05efa5/postlogin.png?w=2500&fit=max&auto=format&n=XMfCJv9jfeC0Q3L4&q=85&s=e2d463098b62a9d19c40f8a65b4cbcca 2500w" />
   </Frame>

6. **［Apply（適用）］** を選択します。

### 実装をテストする

次の手順に従って実装をテストします。

1. `app_metadata`属性の`privacy_policies`に値がない既存のユーザーとしてログインします。
2. ログインフローのログイン後アクションがフォームをレンダリングして、同意を求めます。
3. **［Auth0 Dashboard］>［User Management（ユーザー管理）］>［Users（ユーザー）］** に移動し、ユーザーを見つけて、`app_metadata`属性の`privacy_policies`に`true`値とタイムスタンプが含まれていることを確認します。
