ユーザー登録後トリガー

ユーザー登録後トリガーは、ユーザーがデータベースまたはパスワードレス接続に追加された後に実行されます。

Diagram of the Actions Post User Registration Flow.

このフローのアクションは非ブロック(非同期)であるため、Authパイプラインの実行はアクションの完了を待たずに継続されます。そのため、アクションの結果は、Auth0のトランザクションに影響しません。

トリガー

ユーザー登録後

post-user-registrationトリガーは、ユーザーがデータベースまたはパスワードレス接続用に作成された後に実行されます。このトリガーを使用して、ユーザーがアプリケーションに登録したことを別のシステムに通知できます。このトリガーには複数のアクションをバインドでき、アクションは順番に実行されます。ただし、これらのアクションは非同期で実行されるため、ユーザー登録プロセスがブロックされることはありません。

リファレンス

一般的なユースケース

新しいユーザーが登録されたらSlackに通知する

/**
* Handler that will be called during the execution of a PostUserRegistration flow.
* 
 * @param {Event} event - Details about the context and user that has registered.
 * @param {PostUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of post user registration.
 */

exports.onExecutePostUserRegistration = async (event, api) => {
  const { IncomingWebhook } = require("@slack/webhook");
  const webhook = new IncomingWebhook(event.secrets.SLACK_WEBHOOK_URL);

  const text = `New User: ${event.user.email}`;
  const channel = '#some_channel';

  webhook.send({ text, channel });
};

Was this helpful?

/

Auth0ユーザーIDをリモートシステムに保存する

post-user-registrationアクションを使用して、Auth0ユーザーIDをリモートシステムに保存できます。

/**
* Handler that will be called during the execution of a PostUserRegistration flow.
* 
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of post user registration.
*/

const axios = require("axios");

exports.onExecutePostUserRegistration = async (event, api) => {
  await axios.post("https://my-api.exampleco.com/users", { params: { email: event.user.email }});
};

Was this helpful?

/