User Login
User Login
C2S POST /bp/user/login
S2S POST /bp/server/user/login
接口功能:注册 BytePower
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
请求体
content-type: "application/json"
描述:用户注册所需信息
请求体示例:
js
{
(Platform): {
platform_info
},
"segment_id": "test_segment_id",
"custom_config_id": "custom_config_id_123",
"login_device_id": "login_device_id", // 配合 device 登录使用,设备登录中 id 与 login_device_id 是同一个 id,取值相同。
"simple_cuid": "test_simple_cuid",
"cuid_v2": "test_custom_uid_v2",
"imei": "test_imei",
"oaid": "test_oaid",
"cuid": "test_custom_uid",
"platform": "ios",
"idfa": "test_idfa",
"idfv": "test_idfv",
"gaid": "test_gaid",
"appsflyer_id": "appsflyer_id",
"app_instance_id": "app_instance_id",
"uuid": "uuid"
}
Platform 字段
anonymity
- 说明:匿名登录
- 类型: json
- platform_info: "local_uid": "xxxx"
device
- 说明:设备登录
- 类型: json
- platform_info: "id": "xxx"
apple
- 说明:apple 登录
- 类型: json
- platform_info: "id": "xxx", "code": "xxx", "identity_token": "xxx"
- 说明:facebook 登录
- 类型: json
- platform_info: "access_token": "xxx", "id": "xxx", "expiration_date": 15000000000
- 说明:google 登录
- 类型: json
- platform_info: "id_token": "XXXX"
- 说明:instagram 登录
- 类型: json
- platform_info: "code": "xxx"
- 说明:twitter 登录
- 类型: json
- platform_info: "access_token": "xxx"
discord
- 说明:discord 登录
- 类型: json
- platform_info 示例: "access_token": "xxx"
- 说明:qq登录
- 类型: json
- platform_info 示例: "access_token": "xxx", "open_id": "xxx"
- 说明:微信登录
- 类型: json
- platform_info: "code": "xxx"
alipay
- 说明:支付宝登录
- 类型: json
- platform_info: "code": "xxx"
microsoft
- 说明:微软登录
- 类型: json
- platform_info: "access_token": "xxx"
phone
- 说明:手机号登录
- 类型: json
- platform_info: "phone_number": "+8615512345678", "verify_code": "123456"
name_password
- 说明:用户名密码登录
- 类型: json
- platform_info: "name": "username", "password": "123456"
bp_auth_token
- 说明:bp auth token 登录,在绑定或者登陆出错后会返回,可以无效用户再次授权进行新的登陆绑定操作
- 类型: string
- platform_info: "xxx"
email_password
- 说明:邮箱密码登录
- 类型: json
- platform_info: "email": "xxxx@ihandysoft.com", "password": "123456"
email_code
- 说明:邮箱密码登录
- 类型: json
- platform_info: "email": "xxxx@ihandysoft.com", "verify_code": "123456"
jd
- 说明:京东登录
- 类型: json
- platform_info: "code": "xxx"
响应
HTTP 状态码:200
描述:登录/注册成功 响应示例:
js
{
"user": {
"uid": "u12345",
"name": "happymumu",
"social_accounts": [
{
"platform": Platform,
"id": "110169484474386276334",
"openid":"XXX", // platform 为 wechat 会返回
"xid":"XXX", // jd平台会返回
}
],
"phone": {
"phone_number": "+8615512345678"
},
"email": "xxxx@ihandysoft.com",
"cuid": "test_custom_uid"
},
"bp_auth": { // 第三方平台登陆会有该字段
"bp_auth_token": "xxxxx",
"expire_at_ms": 12345
}
}
HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- anonymous_login_not_allowed
- invalid_parameter
- account.auth_failed
- account.sp_auth_failed
响应示例:
json
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}
HTTP 状态码:405
描述:请求方法错误
响应示例:
json
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}
HTTP 状态码:500
描述:500 错误
响应示例:
json
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}
HTTP 状态码:502
描述:gateway 失败
响应示例:
json
{
"error": {
"error_type": "gateway",
"message": "string"
}
}
User Logout
C2S POST /bp/user/logout
S2S POST /bp/server/user/logout
接口功能:注册 BytePower
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
无
响应
HTTP 状态码:200
描述:登出成功 响应示例:
HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- account.invalid_session
响应示例:
json
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}
HTTP 状态码:405
描述:请求方法错误
响应示例:
json
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}
HTTP 状态码:500
描述:500 错误
响应示例:
json
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}
HTTP 状态码:502
描述:gateway 失败
响应示例:
json
{
"error": {
"error_type": "gateway",
"message": "string"
}
}