POST /api/v1/auth/login/phone-code
POST
/api/v1/auth/login/phone-code手机号验证码登录或注册;新号码可绑定邮箱账号或创建账号
请求体
请求数据
Content-Type · application/json
{
"type": "object",
"required": [
"phone",
"code"
],
"properties": {
"phone": {
"type": "string"
},
"code": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"email_code": {
"type": "string"
},
"password": {
"type": "string"
},
"nickname": {
"type": "string"
}
}
}请求示例
cURL
curl -X POST 'http://localhost:8080/api/v1/auth/login/phone-code' \
-H 'Accept: application/json'JavaScript
const res = await fetch('http://localhost:8080/api/v1/auth/login/phone-code', {
method: 'POST',
headers: {
'Accept': 'application/json'
},
});
const data = await res.json();Python
import requests
res = requests.post(
'http://localhost:8080/api/v1/auth/login/phone-code',
headers={'Accept': 'application/json'}
)
print(res.json())响应
200认证成功(返回 user + tokens)
application/json
{
"type": "object",
"description": "通用响应包装",
"properties": {
"code": {
"type": "string",
"example": "ok"
},
"message": {
"type": "string",
"example": "ok"
},
"data": {}
}
}201认证成功(返回 user + tokens)
application/json
{
"type": "object",
"description": "通用响应包装",
"properties": {
"code": {
"type": "string",
"example": "ok"
},
"message": {
"type": "string",
"example": "ok"
},
"data": {}
}
}202需要 MFA 验证
400请求参数错误
application/json
{
"type": "object",
"properties": {
"code": {
"type": "string",
"example": "not_found"
},
"message": {
"type": "string",
"example": "资源不存在"
}
}
}503手机号登录或短信服务未启用
在线调试
在线调试
凭证仅保存在当前页面内存中自定义请求 Header
