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

> ユーザーが最初のチャレンジを完了した後、新しいパスワードを設定する前に実行される Actions Password Reset Flow について説明します。

# パスワードリセットトリガー

パスワードリセット トリガーは、パスワードリセットのプロセス中に、ユーザーが最初のチャレンジ (通常は[ユーザーのメールアドレス](/ja/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-and-challenge-email-authenticators)に送信されたリンク) を完了した後、新しいパスワードを設定する前に実行されます。これを使用すると、追加の <Tooltip tip="多要素認証（MFA）: SMS による認証コードなど、ユーザー名とパスワードに加えて別の認証要素を使用するユーザー認証プロセス。" cta="用語集を見る" href="/ja/docs/glossary?term=multi-factor+authentication">多要素認証</Tooltip> (MFA) 認証要素でユーザーに追加のチャレンジを要求したり、サードパーティの検証サービスなどの外部サイトにユーザーをリダイレクトしたりできます。

検証後、ユーザーはアカウントの新しいパスワードを入力できます。

<Frame>
  <img src="https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=b55ee347f6001721fc25485dd0f37eb6" alt="パスワードリセット Flow を使用するには、Dashboard > Actions > Flows に移動します" data-og-width="1550" width="1550" data-og-height="564" height="564" data-path="docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=280&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=d9a8676bd131bf5b0c3a52c12a420b22 280w, https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=560&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=e75db55657059dc068c4079864494d05 560w, https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=840&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=f20075008d1096f2a8a6b273d021d33b 840w, https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=1100&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=719bc5a1848687873a2500231a5df8c4 1100w, https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=1650&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=7acc137afb38f17308a82f1aad7df2d3 1650w, https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/7f7eefbf810fd4ebeb22d6393151ffa2/2023-08-14_15-54-03.png?w=2500&fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=5204cd5d35389abf044faa78a70ca8e2 2500w" />
</Frame>

このフロー内の Actions はブロッキング (同期) であるため、トリガー処理の一部として実行され、Action が完了するまで Auth0 パイプラインの残りの処理は実行されません。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  これらの Actions を正しく実行するには、Universal Login を有効にする必要があります。Classic Login を使用している場合、これらの Actions はトリガーされません。
</Callout>

<div id="triggers">
  ## トリガー
</div>

<div id="postchallenge">
  ### PostChallenge
</div>

`post-challenge` トリガーは、ユーザーが最初のパスワードリセット チャレンジ (通常はメールアドレスのマジックリンク) を完了した後に実行される関数です。テナントでは、`post-challenge` トリガーを利用する Actions を最大4つまで作成できます。

<div id="references">
  #### 参考資料
</div>

* [Event object](/ja/docs/customize/actions/explore-triggers/password-reset-triggers/post-challenge-trigger/post-challenge-event-object): Auth0 経由でログインする個々のユーザーに関するコンテキスト情報を提供します。
* [API object](/ja/docs/customize/actions/explore-triggers/password-reset-triggers/post-challenge-trigger/post-challenge-api-object): フローの動作を変更するためのメソッドを提供します。

<div id="limitations">
  ## 制限事項
</div>

パスワードリセット トリガーでは、[Active Directory/LDAP 接続](/ja/docs/authenticate/identity-providers/enterprise-identity-providers/active-directory-ldap)はサポートされていません。

<div id="common-use-cases">
  ## 一般的なユースケース
</div>

<div id="secure-password-reset-with-additional-mfa-factors">
  ### 追加の MFA 認証要素による安全なパスワードリセット
</div>

`password-reset` / `post-challenge` Actions では、ユーザーが最初のチャレンジを完了した後に MFA チャレンジを要求できます。たとえば、テナントで WebAuthn が認証要素として有効になっている場合は、第 2 要素として WebAuthn ベースのチャレンジを要求できます。

```javascript lines theme={null}
/**@type {PasswordResetPostChallengeAction}**/
module.exports.onExecutePostChallenge = async (event, api) => {
  const enrolledFactors = event.user.enrolledFactors.map((x) => ({
    type: x.type
  }));
  api.authentication.challengeWith({ type: 'webauthn-roaming' }, { additionalFactors: enrolledFactors });
};
```

<div id="redirect-users-to-a-third-party-application">
  ### ユーザーをサードパーティ製アプリケーションにリダイレクトする
</div>

MFA チャレンジに加えて、カスタム Action にリダイレクトを追加することもできます。たとえば、サードパーティの検証サービスやリスク評価サービスにリダイレクトできます。

```javascript lines theme={null}
/** @type {PasswordResetPostChallengeAction}
 * このサンプルActionはユーザーをサンプルアプリにリダイレクトし、
 * リダイレクト後にActionを続行してユーザーに
 * MFA要素でチャレンジします
 */

module.exports.onExecutePostChallenge = async (event, api) => {
  // ユーザーを https://my-app.example.com に送信する
  api.redirect.sendUserTo('https://my-app.example.com');
};

module.exports.onContinuePostChallenge = async (event, api) => {
  const enrolledFactors = event.user.enrolledFactors.map((x) => ({
    type: x.type
  }));

  // メールアドレスOTPまたは他の登録済み要素でユーザーにチャレンジする
  api.authentication.challengeWith({ type: 'email' }, { additionalFactors: enrolledFactors });

  // 複数のオプションでユーザーにチャレンジする例
  // この場合、メールアドレスOTPまたはSMS OTP
  // api.authentication.challengeWithAny([{ type: 'email' }, { type: 'sms' }]);
};
```

Auth0 がユーザーをリダイレクトしている間、Actions パイプラインはアクティブになりません。ユーザーが Auth0 のログインプロセスを続行すると、Actions パイプラインは再開されます。リダイレクト前に実行された Actions は再実行されません。詳しくは、[Actions でのリダイレクト](/ja/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/redirect-with-actions)を参照してください。
