> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-actions-triggers-prototype.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

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

> アクションのパスワードリセットフローについて説明します。このフローはユーザーが最初のチャレンジを完了した後、ユーザーがパスワードを設定する前に実行されます。

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

検証したら、ユーザーはアカウントに新しいパスワードを設定することができます。

<Frame>
  <img src="https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=241122c75e528b31bb85bd983cdf7bc5" alt="To use the Password Reset Flow, navigate to Dashboard > Actions > Flows " data-og-width="1550" width="1550" data-og-height="564" height="564" data-path="docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=280&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=4588891b782f634e9fccb74a3d8ff4b0 280w, https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=560&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=e4c4bcc1f00678d28873f6fa8491a59a 560w, https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=840&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=c0d6eabcf7aec06bcdff5daee8ad2966 840w, https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=1100&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=5306bea1f6ae56f3816ff88387460f25 1100w, https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=1650&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=a29507aac8ea54cc01344c6579de6578 1650w, https://mintcdn.com/docs-dev-actions-triggers-prototype/w3k2AH_K7Myvi2qD/docs/images/ja-jp/cdy7uua7fh8z/1Pugm9fFYCmdhh7QO5Klzm/990ecb0eacf7f6fa1f4f09a8a8578bad/2023-08-14_15-54-03.png?w=2500&fit=max&auto=format&n=w3k2AH_K7Myvi2qD&q=85&s=d7256a06e0fbf05206f59bff9fb2a564 2500w" />
</Frame>

このフロー内のアクションはブロッキング（同期的）であり、トリガーのプロセスの一部として実行されます。そのため、アクションが完了するまでAuth0パイプラインの他の部分の実行が停止されます。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  これらのアクションを正常に実行するには、New Universal Loginログインを有効にしなければなりません。これらのアクションは、クラシックログインではトリガーできません。
</Callout>

## トリガー

### PostChallenge

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

#### リファレンス

* [イベントオブジェクト](/docs/ja-jp/customize/actions/explore-triggers/password-reset-triggers/post-challenge-trigger/post-challenge-event-object)：Auth0にログインする1人のユーザーについてのコンテキスト情報を提供します。
* [APIオブジェクト](/docs/ja-jp/customize/actions/explore-triggers/password-reset-triggers/post-challenge-trigger/post-challenge-api-object)：フローの動作を変更するためのメソッドが提供されます。

## 制限事項

パスワードリセットフローは[Active Directory/LDAP接続](/docs/ja-jp/authenticate/identity-providers/enterprise-identity-providers/active-directory-ldap)には対応していません。

## 一般的なユースケース

### 追加のMFA要素でパスワードのリセットを保護する

`password-reset` / `post-challenge`（パスワードリセット/チャレンジ後）アクションはユーザーが最初のチャレンジを完了した後にMFAチャレンジを発行することができます。たとえば、テナントでWebAuthnが要素として有効化されている場合には、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 });
};
```

### ユーザーをサードパーティーのアプリケーションにリダイレクトする

MFAチャレンジの他にも、サードパーティー検証やリスク評価などへのリダイレクトをカスタムアクションに追加してみることができます。

```javascript lines theme={null}
/** @type {PasswordResetPostChallengeAction}
 * This sample action redirects the user to an example app
 * and then continues the action after the redirect to challenge
 * the user with an MFA factor
 */

module.exports.onExecutePostChallenge = async (event, api) => {
  // Send the user to 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
  }));

  // Challenge the user with email otp OR another enrolled factor
  api.authentication.challengeWith({ type: 'email' }, { additionalFactors: enrolledFactors });

  // Example of how to challenge the user with multiple options
  // in this case email otp OR sms otp
  // api.authentication.challengeWithAny([{ type: 'email' }, { type: 'sms' }]);
};
```

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