Logo
Section 1 / 2

注册 Auth0 用户

学习如何通过使用 Auth0 API 在 Auth0 应用程序中注册账号。

导入

注册 Auth0 用户

学习如何通过使用 Auth0 API 在 Auth0 应用程序中注册账号。

...
注册端点

Auth0 的注册端点允许用户在应用程序中创建新账户。当用户提交注册表单时,API 会向该端点发送包含用户信息(如姓名、电子邮箱地址和密码)的请求。该端点随后验证数据并创建新的用户账户。在本节中,我们将使用 `https://{{DOMAIN}}/dbconnections/signup` 端点,通过发送一个 `POST` HTTPS 请求来完成用户注册。

...

参数名称类型类别描述
client_id字符串必填定义客户端 ID。
email字符串必填定义用户的电子邮箱。
password字符串必填定义用户的密码。
connection字符串必填定义用于该用户的连接名称。
username字符串可选定义用户的用户名。
name字符串可选定义用户的姓名。
1// 导入所需库 2const fetch = require('node-fetch'); 3 4const endpointUrl = new URL('https://{{DOMAIN}}/dbconnections/signup'); 5 6const headerParameters = { 7 'Content-Type': 'application/json', 8 'Authorization': 'Bearer {{ACCESS_TOKEN}}', 9}; 10 11const bodyParameters = JSON.stringify({ 12 "client_id": "{{CLIENT_ID}}", 13 "email": "sampleuser@example.com", 14 "password": "secret@123", 15 "connection": "{{CONNECTION_NAME}}", 16 "username": "SampleUser", 17 "name": "Sample User", 18}); 19 20const options = { 21 method: 'POST', 22 headers: headerParameters, 23 body: bodyParameters, 24}; 25 26async function signUp() { 27 try { 28 const response = await fetch(endpointUrl, options); 29 printResponse(response); 30 } catch (error) { 31 printError(error); 32 } 33} 34 35signUp();

名称描述
_id包含我们创建的用户的用户 ID。
email包含我们创建的用户的电子邮箱。
email_verified包含用户的电子邮箱验证状态,表示该邮箱是否已通过 Auth0 验证。
username包含用户的用户名。

攻击防护

登录和登出 Auth0 应用程序