User Bind
User 绑定
C2S POST /bp/user/me/socialaccount
S2S POST /bp/server/user/{user_id}/socialaccount
接口功能:用户绑定第三方平台账号
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
content-type: "application/json"
描述:用户注册所需信息
请求体示例:
{
(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 字段
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"
bp_auth_token
- 说明:bp auth token 登录,在绑定或者登陆出错后会返回,可以无效用户再次授权进行新的登陆绑定操作
- 类型: string
- platform_info: "xxx"
jd
- 说明:京东平台
- 类型: json
- platform_info: "code": "xxx"
google_play_games
- 说明:Google Play Games 平台。采用轻量实现,信任客户端传递的 player_id。
- 类型: json
- platform_info: "player_id": "xxx"
apple_game_center
- 说明:Apple Game Center 平台(仅 iOS)。参数与登录接口一致。player_id 与 team_player_id 至少提供一个,签名相关字段在未开启 Skip Signature Verify 时必填。
- 类型: json
- platform_info:
- "player_id": "G:xxx" — 与 team_player_id 至少提供一个
- "team_player_id": "xxx" — 推荐使用,优先作为 social_id
- "public_key_url": "xxx"(签名验证时必填)
- "salt": "xxx"(签名验证时必填)
- "signature": "xxx"(签名验证时必填)
- "timestamp": 0(签名验证时必填)
响应
HTTP 状态码:200
描述:登录/注册成功 响应示例:
{
"social_account": {
"platform": Platform,
"id": "110169484474386276334",
"openid":"XXX", // platform 为 wechat 会返回
"xid":"XXX", // jd平台会返回
},
"bp_auth": { // 第三方平台登陆会有该字段
"bp_auth_token": "xxxxx",
"expire_at_ms": 12345
}
}HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- invalid_parameter
- account.auth_failed
- account.sp_auth_failed
响应示例:
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}已绑定或者重复绑定会返回 bp_auth 信息,可以依靠它进行 bp_auth_token login 等其它操作而无需用户再次授权
- account.sp_linked_platform
- account.sp_linked_another
{
"error": {
"error_type": "account.sp_linked_another",
"message": "this social account has linked to another user"
},
"bp_auth": {
"bp_auth_token": "xxx",
"expire_at_ms": 12345
}
}HTTP 状态码:405
描述:请求方法错误
响应示例:
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}HTTP 状态码:500
描述:500 错误
响应示例:
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}HTTP 状态码:502
描述:gateway 失败
响应示例:
{
"error": {
"error_type": "gateway",
"message": "string"
}
}User 解绑
C2S DELETE /bp/user/me/socialaccount/{platform}/{id}
S2S DELETE /bp/server/user/{user_id}/socialaccount/{platform}/{id}
接口功能:用户解绑第三方平台账号
platform、id 皆是来自于 social_account。
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
无
响应
HTTP 状态码:200
描述:解绑成功 响应示例:
HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- account.invalid_session
响应示例:
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}HTTP 状态码:405
描述:请求方法错误
响应示例:
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}HTTP 状态码:500
描述:500 错误
响应示例:
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}HTTP 状态码:502
描述:gateway 失败
响应示例:
{
"error": {
"error_type": "gateway",
"message": "string"
}
}User 重新授权
C2S PUT /bp/user/me/socialaccount/{platform}/{id}
S2S PUT /bp/server/user/{user_id}/socialaccount/{platform}/{id}
接口功能:用户重新授权第三方平台账号,目前只支持 facebook
platform、id 皆是来自于 social_account。
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
{
"facebook": {
"access_token": "xxx",
"id": "xxx",
"expiration_date": 15000000000
}
}响应
HTTP 状态码:200
描述:成功 响应示例:
{
"social_account": {
"platform": "facebook",
"access_token": "xxx",
"id": "fu12345",
"expiration_date": 15000000000
}
}HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- account.invalid_session
响应示例:
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}HTTP 状态码:405
描述:请求方法错误
响应示例:
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}HTTP 状态码:500
描述:500 错误
响应示例:
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}HTTP 状态码:502
描述:gateway 失败
响应示例:
{
"error": {
"error_type": "gateway",
"message": "string"
}
}获取用户信息
C2S GET /bp/user/me
S2S GET /bp/server/user/{user_id}
接口功能:获取用户信息,包括绑定的社交账号信息(social_accounts 中会包含 social_profile 字段)。
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
无
响应
HTTP 状态码:200
描述:成功,返回用户信息
响应示例:
{
"user": {
"create_time": 1705563219620,
"cuid": "C6B48274-2CC1-45B5-8728-982532C7C108",
"is_new_user": false,
"name": "",
"phone": {
"phone_number": ""
},
"social_accounts": [
{
"access_token": "ae08e676c83af4afaa031053efba16a2b.0.prtqr.UINhQjvUazaEqhTAjcBp9A",
"expiration_date": 0,
"id": "001301.6cd97aa9ec6a4802a22660faa653d947.0351",
"platform": "apple",
"refresh_token": "rfc70bbe2c3294b1b9549ea117c9e9314.0.prtqr.CMXcvTTACzEsHxVBHIjCoQ",
"social_profile": {
"social_id": "001301.6cd97aa9ec6a4802a22660faa653d947.0351",
"platform": "apple",
"user_name": "",
"avatar": "",
"email": "vh9dd4tdpp@privaterelay.appleid.com",
"region": "",
"province": "",
"city": "",
"gender": 0
}
}
],
"uid": "UUEE4AFKVEZ3G"
}
}HTTP 状态码:400
描述:400 错误
error_type 错误类别:
- app_not_found
- invalid_parameter
- account.invalid_session
响应示例:
{
"error": {
"error_type": "app_not_found",
"message": "app is not found"
}
}HTTP 状态码:404
描述:用户不存在
响应示例:
{
"error": {
"error_type": "not_found",
"message": "user not found"
}
}HTTP 状态码:405
描述:请求方法错误
响应示例:
{
"error": {
"error_type": "method_not_allowed",
"message": "string"
}
}HTTP 状态码:500
描述:500 错误
响应示例:
{
"error": {
"error_type": "internal",
"message": "internal server error"
}
}HTTP 状态码:502
描述:gateway 失败
响应示例:
{
"error": {
"error_type": "gateway",
"message": "string"
}
}Social Profile
Social Profile 与 Social Account 接口更新说明。针对 Social Profile 的新增,以及 Social Account 接口中添加 Social Profile 信息返回的改动,整理接口更新说明如下。
核心数据结构: PublicSocialProfile
在所有涉及到 Social Profile 的返回数据中,均统一使用以下数据结构返回第三方账号的公开资料信息:
{
"social_id": "string", // 第三方平台的唯一用户 ID
"platform": "string", // platform 标识(如 apple, google, facebook, wechat 等)
"user_name": "string", // 用户昵称
"avatar": "string", // 用户头像 URL
"email": "string", // 用户邮箱
"region": "string", // 地区
"province": "string", // 省份
"city": "string", // 城市
"gender": 0 // 性别 (0: 未知, 1: 男, 2: 女)
}查询 Social Profile 接口
C2S GET /bp/user/me/social_profiles
接口功能:获取当前登录用户的 Social Profiles
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
- X-BytePower-Session-Token:登录后获取用户的 session。
请求体
无
响应
HTTP 状态码:200
描述:成功,返回该用户绑定的所有拥有公开资料的第三方平台 Profile 列表。
响应示例:
{
"social_profiles": [
{
"social_id": "12345",
"platform": "google",
"user_name": "Test User",
"avatar": "https://...",
"email": "test@google.com",
"region": "",
"province": "",
"city": "",
"gender": 0
}
]
}S2S GET /bp/server/user/{user_id}/social_profile
接口功能:批量查询用户的 Social Profiles
请求头部参数 (Headers):
- X-BytePower-Sign:请求体签名
Query 参数
user_ids: string,按逗号分隔的用户 ID 列表,例如user1,user2
响应
HTTP 状态码:200
描述:成功,返回按
user_id分组的字典,以及未找到记录的用户 ID 列表。响应示例:
{
"social_profile": {
"user_id_1": [
{
"social_id": "12345",
"platform": "apple",
"user_name": "Test User",
"avatar": "https://...",
"email": "test@apple.com",
"region": "",
"province": "",
"city": "",
"gender": 0
}
]
},
"inexistent_user_ids": [
"user_id_2"
]
}现有 Social Account 接口结构更新
在返回社交账号信息(Social Account 对象)的所有核心接口中,返回结构均已增加 social_profile 可选字段。
重要提示: 由于数据获取是异步的,绑定/登录类接口(如 Link、Login)在操作成功的即时响应中通常不包含该字段。仅在后续抓取任务完成后,通过查询接口(如
GET /me)才能获取到。
涉及接口(包含但不限于):
- 用户信息查询:
C2S GET /bp/user/me(获取用户信息,返回的social_accounts中会包含social_profile字段) - 账号绑定/操作:
C2S POST /bp/user/me/socialaccount(Link)、C2S PUT /bp/user/me/socialaccount/{platform}/{id}(Reauth) 等
返回结构示例(以某次获取 Social Account 返回对象为例):
{
"platform": "google",
"id": "123456789",
"access_token": "...",
"expiration_date": 123456,
"social_profile": {
"social_id": "123456789",
"platform": "google",
"user_name": "Test User",
"avatar": "https://...",
"email": "test@google.com",
"region": "",
"province": "",
"city": "",
"gender": 0
}
}说明: social_profile 嵌套字段为可选返回项。仅当该关联的第三方平台(例如 Google、Apple、Facebook)能提供且成功记录了该用户的额外 Profile 信息时,此对象才会暴露。
注意事项
Social Profile 是异步获取的。 在调用绑定(Link)接口时,由于背景任务处理延迟,通常在绑定成功的即时响应中无法获取到最新的 social_profile 数据。建议在绑定成功后的稍后时间点,或通过专门的查询接口重新确认 Profile 状态。
