Auth0:让用户重新发送验证电子邮件

HND*_*NDK 5 email verification auth0

我在 Auth0 中启用了用户/密码连接,我希望在继续之前验证电子邮件。我启用了相应的规则来强制电子邮件验证,一切似乎都按预期工作。

不过,我注意到在注册时发送了验证电子邮件。我想要一个按钮来允许再次发送该电子邮件,但这似乎不可能。

用户如何从 UI 请求验证电子邮件?

调用https://<tenantName>.auth0.com/api/v2/jobs/verification-email不起作用,因为令牌需要update:users范围。我们可以通过对 的请求获得具有该范围的令牌https://<tenantName>.auth0.com/oauth/token,但这意味着客户端机密将被公开。

ali*_*m91 1

there is a work around for this, I use it as a post email verification signal. auth0 create a ticket and send us a link with the ticket id as query string to verify the email, the link sent is like below:

https://<domain>/u/email-verification?ticket=h7CtBxPXiej7FtaKo0UHYJtdWPazaHhs#
Run Code Online (Sandbox Code Playgroud)

you can use this api to resend the email verfication link, here is an example of the request:

curl --location --request POST 'https://<domain>/api/v2/tickets/email-verification' \
--header 'Authorization: Bearer <token> \
--header 'Content-Type: application/json' \
--header 'Cookie: __cfduid=d7aa37a65221ad2c0fd17ec71c76f13eb1603727648; did=s%3Av0%3A694d6590-1a83-11eb-877d-d1f701a6b5e1.qweiCQT%2Fah2JbVlHe8mU7En5egRFtrEmjETM%2B%2BIKmzc; did_compat=s%3Av0%3A694d6590-1a83-11eb-877d-d1f701a6b5e1.qweiCQT%2Fah2JbVlHe8mU7En5egRFtrEmjETM%2B%2BIKmzc' \
--data-raw '{
  "result_url": "<redirection_url>",
  "user_id": <auth0_user_id>,
  "ttl_sec": 0,
  "includeEmailInRedirect": false,
  "identity": {
    "user_id": "<user_id>",
    "provider": "auth0"
  }
}'
Run Code Online (Sandbox Code Playgroud)