Account-API WEB 集成教程
快速使用
第一步:引入 SDK
目前已支持npm包
方式和CDN
方式
npm 方式
$ npm install @intlsdk/account-api
CDN 方式
<script src="https://test-common-web.intlgame.com/sdk-cdn/account-api/index.umd.js"></script>
<script src="https://common-web.intlgame.com/sdk-cdn/account-api/index.umd.js"></script>
第二步:使用 SDK
参数说明
Parameter | Type | Description |
---|
env | string | SDK 运行环境,详见下“env 说明” |
langType | string | 语言类型 |
appID | string | App ID |
accountPlatType | number | 自建账号平台类型 |
gameID | number | INTL 游戏唯一标识 ID |
env 说明:
测试联调阶段,提供联调环境
:
统一联调:'test'
LonelyFish 联调:us-test
现网环境
(正式环境):
新加坡:'sg'
北美:'na'
欧洲:'eu'
LonelyFish:'lonelyfish'
实例化对象
调用不同功能 API,实例化对象入参会有不同,具体入参说明如下:
1、自建账号相关
const accountApi = new IntlgameAccountApi({
env: 'test',
langType: 'en',
appID: '',
accountPlatType: 52,
gameID: 11,
});
2、第三方渠道相关
const accountApi = new IntlgameAccountApi({
env: 'test',
gameID: 11,
});
API 说明文档
一、自建账号相关
1、自建账号登录
signIn
自建账号密码登录
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
password | string | 【必填】密码 |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | 用户授权令牌 |
uid | string | 帐户的 UID |
seq | string | 数据流消息序号 |
expire | int64 | 令牌过期时间 |
Demo
api.signIn(
{
account:'xxx@gmail.com',
account_type:1,
password:'xxx',
}
).then((res) => {
console.log(res);
});
response log:
{
expire: 1638490279
msg: "Success",
ret: 0,
seq: "1638190279-0180225865-002725-0000290492",
token: "xxx",
uid: "xxx",
}
verifyCodeSignIn
自建账号验证码登录
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
verify_code | string | 【必填】验证码 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | 用户授权令牌 |
uid | string | 帐户的 UID |
seq | string | 数据流消息序号 |
expire | int64 | 令牌过期时间 |
Demo
api.verifyCodeSignIn(
{
verify_code: '12345',
account:'lhmtyn47025@chacuo.net',
account_type: 1,
}
).then((res) => {
console.log(res);
});
response log:
{
expire: 1639143369,
msg: "Success",
ret: 0,
seq: "1638843369-0180225865-009373-0000156600",
token: "xxx==",
uid: "xxx",
}
intlSignIn
INTL 账号登录(使用自建账号)
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
account_plat_type | string | 【必填】自建账号平台类型,用于识别不同的账户平台 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | INTL 生成的用户授权令牌,长度 40 字节 |
openid | string | INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位。 |
token_expire_time | int64 | INTL token 过期时间 |
user_name | string | 用户名 |
birthday | string | 生日 |
channel_info | object | 登录 INTL 的渠道信息 |
seq | string | 数据流消息序号 |
Demo
api.intlSignIn(
{
token:'xxx',
openid:'xxx',
account_plat_type:52,
}
).then((res) => {
console.log(res);
});
response log:
{
birthday: "2000-01",
channel_info:{
account_plat_type: 52,
expire_ts: 1638494026,
openid: "yyy",
token: "yyy"
},
first_login: 0,
gender: 0,
msg: "success",
need_name_auth: false,
openid: "xxx",
pf: "INTLProject_INTLProject-00000000-web-00000000-INTLProject-30296142ab2912409cf157510543519c-13635546925269953152",
pf_key: "768218411f6de0be1c502564fefc8b45",
picture_url: "",
reg_channel_dis: "00000000",
ret: 0,
seq: "1638194026-0180225310-032531-0000292460",
token: "xxx",
token_expire_time: 1638494026,
uid: "xxxx",
user_name: "aa921127639de",
}
2、自建账号用户信息
queryUserInfo
获取用户信息
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
account_type | number | 账号类型 |
birthday | string | 生日 |
email | string | 邮箱 |
expire | int64 | token 过期时间 |
is_receive_email | number | 是否接收邮件推送 1:推送 其他:不推送 |
lang_type | string | 语言 |
nick_name | string | 昵称 |
privacy_policy | string | 用户隐私政策版本 |
privacy_update_time | int64 | 用户隐私政策更新时间 |
region | string | 地区 |
terms_of_service | string | 用户服务条款版本 |
terms_update_time | int64 | 用户服务条款更新时间 |
uid | string | 帐户的 UID |
user_name | string | 用户名 |
seq | string | 数据流消息序号 |
Demo
api.queryUserInfo(
{
token:'xxx',
openid:'xxx',
}
).then((res) => {
console.log(res);
});
response log:
{
account_type: 1,
birthday: "2000-01",
email: "921127639@qq.com",
expire: 1638494026,
is_receive_email: 0,
lang_type: "en",
msg: "Success",
nick_name: "921127639",
phone: "",
phone_area_code: "",
privacy_policy: "1",
privacy_update_time: 1638196548,
region: "156",
ret: 0,
seq: "1638194050-0180225865-002725-0000292413",
terms_of_service: "1",
terms_update_time: 1638196548,
uid: "xxx",
user_name: "aa921127639de",
username_pass_verify: 1,
}
modifyProfile
修改个人信息
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
user_name | string | 【选填】用户名,不可重复 |
nick_name | string | 【选填】 用户昵称,可重复 |
birthday | string | 【选填】用户生日 |
region | string | 【选填】国家地区码,引用 ISO_3166-1 标准,对应的三位数字码 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
birthday | string | 生日 |
email | string | 邮箱 |
is_receive_email | number | 是否接收邮件推送 1:推送 其他:不推送 |
lang_type | string | 语言 |
nick_name | string | 昵称 |
phone | string | 手机号码 |
phone_area_code | string | 手机区号 |
region | string | 地区 |
seq | string | 数据流消息序号 |
user_name | string | 用户名 |
Demo
api.modifyProfile(
{
token:'xxx',
openid:'xxx',
user_name:'xxx',
nick_name:'xxx',
birthday:'xxx',
region:'xxx'
}
).then((res) => {
console.log(res);
});
response log:
{
birthday: "1998-10",
email: "921127639@qq.com",
is_receive_email: 0,
lang_type: "en",
msg: "Success",
nick_name: "abc921127639",
phone: "",
phone_area_code: "",
region: "156",
ret: 0,
seq: "1638239120-0180225310-032531-0000366843",
user_name: "abc921127639",
}
queryUserNameStatus
检查用户名是否被注册
Request parameters:
Parameter | Type | Description |
---|
user_name | string | 【必填】用户名 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
username_available | string | 用户名是否可用 0:不可用 1:可用 |
Demo
api.queryUserNameStatus(
{
user_name:'xxx',
}
).then((res) => {
console.log(res);
});
response log:
{
msg: "Success",
ret: 0,
seq: "1638239867-0180225865-009373-0000002944",
username_available: 1,
}
modifyUserAgreement
修改用户信息隐私政策、服务条款版本号
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
privacy_policy | string | 【必填】隐私政策版本号(不能设置成之前已经设置过的版本,只能升级版本) |
terms_of_service | string | 【必填】服务条款版本号(不能设置成之前已经设置过的版本,只能升级版本) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
privacy_policy | string | 用户隐私政策版本 |
terms_of_service | string | 用户服务条款版本 |
seq | string | 数据流消息序号 |
Demo
api.queryUserInfo(
{
token:'xxx',
openid:'xxx',
privacy_policy:'0.1',
terms_of_service:'0.1',
}
).then((res) => {
console.log(res);
});
response log:
{
msg: "Success",
privacy_policy: "0.1",
ret: 0,
seq: "1638240816-0180225310-032531-0000367889",
terms_of_service: "0.1",
}
3、自建账号注册
queryRegisterStatus
查询自建账号是否被注册
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
is_register | number | 账号是否存在 0:不存在 1:存在 |
seq | string | 数据流消息序号 |
Demo
api.queryRegisterStatus(
{
account:'xxx@gmail.com',
account_type:1,
phone_area_code:'86',
}
).then((res) => {
console.log(res);
});
response log:
{
is_register: 0,
msg: "Success",
ret: 0,
seq: "1638794583-0180225865-009373-0000146261",
}
register
自建账号密码注册
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
password | string | 【必填】密码 |
user_name | string | 【选填】用户名,不可重复 |
nick_name | string | 【选填】用户昵称,可重复 |
birthday | string | 【选填】用户生日 |
region | string | 【选填】国家地区码,引用 ISO_3166-1 标准,对应的三位数字码 |
is_receive_email | number | 【选填】是否接收邮件推送 1:推送 其他:不推送 |
verify_code | string | 【是否必填受管理端自建账号登录配置控制】验证码 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | 用户授权令牌 |
uid | string | 帐户的 UID |
seq | string | 数据流消息序号 |
expire | int64 | 令牌过期时间 |
Demo
api.register(
{
verify_code: '12345',
account:'lhmtyn47025@chacuo.net',
account_type: 1,
password:'xxxx',
user_name: 'lhmtyn47025',
nick_name: 'lhmtyn47025',
birthday:'2000-01',
region:'156',
user_lang_type: 'en',
is_receive_email: 0,
}
).then((res) => {
console.log(res);
});
response log:
{
expire: 1639096606
msg: "Success"
ret: 0
seq: "1638796606-0180225310-009909-0000096176"
token: "xxxx@o@j1HBUIpXeuaGv9WdmW1eTpdEA=="
uid: "xxxxx"
}
verifyCodeRegister
自建账号验证码注册
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
password | string | 【选填】 密码 |
user_name | string | 【选填】 用户名,不可重复 |
nick_name | string | 【选填】 用户昵称,可重复 |
birthday | string | 【选填】 用户生日 |
region | string | 【选填】 国家地区码,引用 ISO_3166-1 标准,对应的三位数字码 |
is_receive_email | number | 【选填】 是否接收邮件推送 1:推送 其他:不推送 |
verify_code | string | 【必填】验证码 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | 用户授权令牌 |
uid | string | 帐户的 UID |
seq | string | 数据流消息序号 |
expire | int64 | 令牌过期时间 |
Demo
api.register(
{
verify_code: '12345',
account:'lhmtyn47025@chacuo.net',
account_type: 1,
password:'xxxx',
user_name: 'lhmtyn47025',
nick_name: 'lhmtyn47025',
birthday:'2000-01',
region:'156',
user_lang_type: 'en',
is_receive_email: 0,
}
).then((res) => {
console.log(res);
});
response log:
{
expire: 1639098097,
msg: "Success",
ret: 0,
seq: "1638798097-0180225310-009909-0000096715",
token: "2U6wTrNjD...8VIXE2WJiU5vzA==",
uid: "381312780823",
}
4、发送验证码
requestVerifyCode
发送邮箱/手机验证码(暂不支持手机)
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】 手机区号【account_type=2 时必填】 |
code_type | number | 【必填】生成的验证码类型 0:注册 1:修改密码 2:登录、验证码注册 3:修改主体注册账号 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
expire_time | number | 验证码过期时间,单位:秒(s) |
seq | string | 数据流消息序号 |
Demo
api.requestVerifyCode(
{
account:'xxx@gmail.com',
account_type:1,
code_type:0
}
).then((res) => {
console.log(res);
});
response log:
{
expire_time: 179998
msg: "Success"
ret: 0
seq: "1638242466-0180225865-009373-0000004742"
}
5、人机识别
requestVerifyImage
获取图形验证码
Request parameters:
无
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
sessionid | string | 图形验证码 sessionid |
url | string | 图形验证码 url,data 类型的 url 格式 |
Demo
api.requestVerifyImage().then(
(res) => {
console.log(res);
}
);
response log:
{
msg: "success"
ret: 0
sessionid: "8fd9a8dcb4346066eded5ae6a11fbcdc20"
url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAUAgMAAACsbba6AAAACVBMVEUAAADIyMj///8U+jb4AAAAnUlEQVQYlV1QSQ7EMAhzDr63Uvyf9MCdSvD/rwx0GY2GKFGMjQMB/kJhZ6byjsCs0/raKQVuxr78q8z0M+3BTS9oj6p/BRZ69AIKz8aOPYHTr/rezXutpTxef8+RZDIaw4pgiMFqqflVKKTLYxYOeuePu9/dygxBHtXUodYnix/mchZfiDa3EZSueWkJDfY8l78Py1g9Rr0EbL+/NT/YIkHb2zrHQwAAAABJRU5ErkJggg=="
}
google 和 tencent 人机识别
google recaptcha 和 tencent recaptcha 不提供 API 接入,调用者如有需要可自行参考其官方接入流程
google recaptcha v2 参考:https://developers.google.com/recaptcha/docs/display
tencent recaptcha 参考:https://cloud.tencent.com/product/captcha
6、修改密码
resetPassword
修改密码
Request parameters:
Parameter | Type | Description |
---|
account | string | 【必填】账号,邮箱或手机号(暂不支持手机) |
account_type | number | 【必填】账号类型 1:email 2:phone |
phone_area_code | string | 【account_type=2 时必填】手机区号 |
password | string | 【必填】新密码 |
verify_type | number | 【必填】验证方式 1:使用验证码 2:使用旧密码 |
old_password | string | 【verify_type=2 时必填】旧密码 |
verify_code | string | 【verify_type=1 时必填】验证码 |
machine_check_type | number | 【是否必填受管理端自建账号登录配置控制】人机识别方式 1:图形验证码 2:google 人机识别 3:tencent 人机识别 |
png_verify_code | string | 【machine_check_type=1 时必填】 图形验证码 |
session_id | string | 【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回) |
google_response | string | 【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如: 03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw |
tencent_response | string | 【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如: JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"}) |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.resetPassword({
account:'xxx@gmail.com',
account_type:1,
password:'xxxxxxxx',
old_password:'xxxxxxx',
verify_type:2,
}).then(
(res) => {
console.log(res);
}
);
response log:
{
msg: "Success",
ret: 0,
seq: "1638845449-0180225310-009909-0000106697",
}
7、登出
logout
登出
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
uid | string | 【必填】自建账号,帐户 UID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.resetPassword({
token:'4567xsdfsd',
uid:'xxxxxxxx',
}).then(
(res) => {
console.log(res);
}
);
response log:
{
msg: "Success",
ret: 0,
seq: "1638845449-0180225310-009909-0000106697",
}
二、第三方登录相关
thirdAuthorize
第三方渠道授权
Request parameters:
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 steam facebook google twitch ps5 twitter discord epic line apple |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
access_token | string | 渠道访问令牌 |
Demo
api.thirdAuthorize({
third_type:'facebook'
}).then(
(res) => {
console.log(res);
}
);
response log:
{
msg: "Success",
ret: 0,
access_token: "xxxxx",
}
intlAuthorize
INTL 账号授权
Request parameters:
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 steam facebook google twitch ps5 twitter discord epic line apple |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
token | string | INTL 生成的用户授权令牌,长度 40 字节 |
openid | string | INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位。 |
token_expire_time | int64 | INTL token 过期时间 |
user_name | string | 用户名 |
birthday | string | 生日 |
channel_info | object | 登录 INTL 的渠道信息 |
seq | string | 数据流消息序号 |
Demo
api.intlAuthorize({
third_type:'facebook',
channel_info:{
access_token: "EAAI2lTrXAZBwBAC"
}
}).then(
(res) => {
console.log(res);
}
);
response log:
{
birthday: "",
channel_info: {
access_token:"xxxxx",
expire_ts: 1641527900,
}
first_login: 0,
gender: 0,
msg: "success",
need_name_auth: false,
openid: "xxxx",
pf: "facebook_fb-00000000-web-00000000-fb-622964518618092-419213088809929925",
pf_key: "6cc9bbeb8dd9d75bbecf05aa02813826",
picture_url: "https://scontent-sin6-3.xx.fbcdn.net/v/t1.30497-1/c47.0.160.160a/p160x160/ 84628273_176159830277856_972693363922829312_n.jpg?_nc_cat=1&ccb=1-5&_nc_sid=12b3be&_nc_ohc=XyWt8Z2JeBcAX9WC9NK&_nc_ht=scontent-sin6-3.xx&edm=AP4hL3IEAAAA&oh=0e55aa499d6f1a4355f5e453bf6f7b9d&oe=61D60D85",
reg_channel_dis: "00000000",
ret: 0,
seq: "1638935899-1006943754-018668-0000656615",
token: "xxx",
token_expire_time: 1641527900,
uid: "xxxx",
user_name: "Lucas Fan",
}
三、分享
share
第三方渠道分享
Request parameters:
facebook
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 facebook |
app_id | string | 【必填】申请 facebook 应用的唯一标识符 |
href | string | 【必填】对此帖子附加的链接 |
hashtag | string | 【选填】开发人员指定的要添加到分享内容中的话题标签 |
quote | string | 【选填】要与链接一起分享的语录,由用户突出显示或由开发者预先指定,例同对某一文章的醒目引述 |
display | string | 【选填】对话框呈现方式 page iframe popup touch |
redirect_uri | string | 【选填】用户点击对话框中的按钮后重新定向到此网址 |
twitter
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 twitter |
url | string | 【选填】共享 URL, 将在已发布的推文中自动缩短。 共享 URL 可能会出现一张卡片。 |
via | string | 【选填】使用 via 参数@用户 |
text | string | 【选填】文本参数显示在推文编辑器中预选。 推文作者可以通过单个删除操作轻松删除文本 |
hashtags | string | 【选填】使用 hashtags 参数向推文添加逗号分隔的主题标签列表 |
vk
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 vk |
url | string | 【必填】分享链接 |
description | string | 【选填】描述 |
image | string | 【选填】图片地址 |
title | string | 【选填】标题 |
Response parameters:
无,没有返回结果
Demo
api.share({
third_type: 'facebook',
href: 'https://test-common-web.intlgame.com/jssdk/map-demo.html',
hashtag: '#facebook',
quote: 'facebook',
app_id: 'xxxxx',
display: 'page',
redirect_uri: 'https://test-common-web.intlgame.com/jssdk/map-demo.html',
});
四、绑定
bind
绑定
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】INTL 生成的用户授权令牌,长度 40 字节 |
openid | string | 【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位 |
oauth_channelid | number | 【必填】发起绑定的 INTL 授权渠道 ID |
bind_channel_info | object | 【必填】被绑定渠道的登录信息,不同渠道内容不同 |
bind_channelid | number | 【必填】被绑定渠道的 INTL 授权渠道 ID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.bind({
openid:'xxx',
token:'xxxx',
oauth_channelid:4,
bind_channelid:9,
bind_channel_info:{
oauth_token: "xxxxx",
oauth_secret:"xxxxxx",
},
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
seq: "1639105985-1191493130-031434-0000571640",
}
unbind
解除绑定
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】INTL 生成的用户授权令牌,长度 40 字节 |
openid | string | 【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位 |
oauth_channelid | number | 【必填】发起解除绑定的 INTL 授权渠道 ID |
unbind_channelid | number | 【必填】被解除绑定渠道的 INTL 授权渠道 ID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.unbind({
openid:'xxx',
token:'xxx',
oauth_channelid:4,
unbind_channelid:9,
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
seq: "1639105985-1191493130-031434-0000571640",
}
getBindChannelsByOpenID
根据 INTL openID 获取绑定列表
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】INTL 生成的用户授权令牌,长度 40 字节 |
openid | string | 【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位 |
channel_id | number | 【必填】INTL 授权渠道 ID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
bind_list | array | 绑定列表 |
seq | string | 数据流消息序号 |
Demo
api.getBindChannelsByOpenID({
openid:'xxx',
token:'xxx',
channel_id:4,
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
bind_list: [
{
channel_info: {},
channelid: 28,
is_primary: 0,
picture_url: "https://static-cdn.jtvnw.net/user-default-pictures…-11e9-b668-784f43822e80-profile_image-300x300.png",
user_name: "defierzhang"
},
{
channel_info: {},
channelid: 4,
is_primary: 0,
picture_url: "https://scontent-sin6-3.xx.fbcdn.net/v/t1.30497-1/…A&oh=96bf3f281173d2360139204b31f6a5f3&oe=61DA0205",
user_name: "Lucas Fan"
}
],
seq: "1639105985-1191493130-031434-0000571640",
}
getBindChannelsByUid
根据渠道登录信息获取绑定列表
Request parameters:
Parameter | Type | Description |
---|
channel_id | number | 【必填】INTL 授权渠道 ID |
channel_info | object | 【必填】渠道的登录信息,不同渠道内容不同 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
bind_list | array | 绑定列表 |
seq | string | 数据流消息序号 |
Demo
api.getBindChannelsByOpenID({
channel_id:4,
channel_info:{
access_token:"EAAI2lTrXAZBwBAEWdBW...LUdVblu9qPwZDZD"
}
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
bind_list: [
{
channel_info: {},
channelid: 28,
is_primary: 0,
picture_url: "https://static-cdn.jtvnw.net/user-default-pictures…-11e9-b668-784f43822e80-profile_image-300x300.png",
user_name: "defierzhang"
},
{
channel_info: {},
channelid: 4,
is_primary: 0,
picture_url: "https://scontent-sin6-3.xx.fbcdn.net/v/t1.30497-1/…A&oh=96bf3f281173d2360139204b31f6a5f3&oe=61DA0205",
user_name: "Lucas Fan"
}
],
seq: "1639105985-1191493130-031434-0000571640",
}
五、映射
map
映射
Request parameters:
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 steam facebook google twitch ps5 discord epic |
channel_info | object | 【必填】渠道的登录信息,不同渠道内容不同 |
sacc_channel_info | object | 【必填】自建账号的登录信息 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.map({
third_type:'facebook',
channel_info:{
access_token:"EAAI2lTrXAZBwBAEWdBW...LUdVblu9qPwZDZD"
},
sacc_channel_info:{
token:"vOrEZi@nAJ8CZIC...u7Phiu_r7HfcHuQ==",
openid:"4966271191",
account_plat_type:25
}
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
seq: "1639105985-1191493130-031434-0000571640",
}
unmap
解除映射
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
unmap_channelid | number | 【必填】解除映射的 INTL 授权渠道 ID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
seq | string | 数据流消息序号 |
Demo
api.unmap({
token:'vOrEZi@nAJ8CZICmY...WS7JMEu7Phiu_r7HfcHuQ==',
openid:'49...91',
unmap_channelid:28
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
seq: "1639105985-1191493130-031434-0000571640",
}
queryMapByCAccInfo
根据自建账号登录信息获取映射到该自建账号的渠道列表
Request parameters:
Parameter | Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
uid_list | array | 映射渠道 uid 列表 |
seq | string | 数据流消息序号 |
Demo
api.queryMapByCAccInfo({
token:'vOrEZi@nAJ8CZICmY...WS7JMEu7Phiu_r7HfcHuQ==',
openid:'49...91',
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
extra_field: ""
need_auth: false
sacc_uid: ""
uid_list: [
{
channelid: 4
uid: "633...105"
},
{
channelid: 6
uid: "11249...58500"
}
],
seq: "1639105985-1191493130-031434-0000571640",
}
queryMapByThirdInfo
根据渠道登录信息获取该渠道映射的自建账号 uid
Request parameters:
Parameter | Type | Description |
---|
third_type | string | 【必填】第三方渠道类型 steam facebook google twitch ps5 discord epic |
channel_info | object | 【必填】渠道的登录信息,不同渠道内容不同 |
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
sacc_uid | string | 自建账号 uid |
need_auth | boolean | 是否需要登录自建账号 |
seq | string | 数据流消息序号 |
Demo
api.queryMapByThirdInfo({
token:'vOrEZi@nAJ8CZICmY...WS7JMEu7Phiu_r7HfcHuQ==',
openid:'49...91',
}).then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
extra_field: "",
need_auth: false,
sacc_uid: "496...191",
seq: "1639127682-0343981578-017518-0001975655",
uid_list: [],
}
六、其他
1、根据 ip 获取国家地区信息
queryMyCountry
根据 ip 获取国家地区信息
Request parameters:
无,不需要传参
Response parameters:
Parameter | Type | Description |
---|
ret | number | 结果返回码 0:请求成功,可以解析相关返回字段信息 !=0:请求逻辑失败, msg 里面有具体错误信息 |
msg | string | 结果说明 |
alpha2 | string | 国家地区代码,2 位代码 ISO 3166-1 标准 |
region | string | 国家地区代码,3 位数字代码 ISO 3166-1 标准 |
timestamp | number | Unix 时间戳 |
seq | string | 数据流消息序号 |
Demo
api.queryMyCountry().then(
(res) => {
console.log(res);
}
);
response log:
{
ret: 0,
msg: "success",
alpha2: "HK",
region: "344",
seq: "1639128374-0343981578-017512-0000925611",
timestamp: 1639128374,
}
信息说明
一、Channel ID 说明
Channel | Channelid |
---|
guest | 3 |
facebook | 4 |
google | 6 |
twitter | 9 |
garena | 10 |
line | 14 |
apple | 15 |
steam | 21 |
epic | 24 |
discord | 26 |
ps5 | 27 |
twitch | 28 |
二、Channel Info 说明
Custom Account
Fields | Data Type | Description |
---|
token | string | 【必填】自建账号,用户授权令牌 |
openid | string | 【必填】自建账号,帐户 UID |
account_plat_type | string | 【必填】自建账号平台类型,用于识别不同的账户平台 |
Facebook
Classic Facebook Login
Fields | Data Type | Description |
---|
access_token | string | 【必填】 网页用户的访问令牌 |
Google
Fields | Data Type | Description |
---|
code | string | 【必填】 可用于获取访问令牌的授权码 |
Fields | Data Type | Description |
---|
oauth_token | string | 【必填】 网页用户的访问令牌 |
oauth_secret | string | 【必填】 网页用户的访问口令密钥 |
Line
Fields | Data Type | Description |
---|
access_token | string | 【必填】 网页用户的访问令牌 |
expires_in | int64 | 【选填】访问令牌到期前的时间量(以秒为单位) |
Apple
Fields | Data Type | Description |
---|
code | string | 【必填】可用于获取访问令牌的授权码 |
user_name | string | 【选填】渠道返回用户名 |
VK
Fields | Data Type | Description |
---|
token | string | 【必填】 网页用户的访问令牌 |
Steam
Fields | Data Type | Description |
---|
openid.ns | string | 【必填】 |
openid.mode | string | 【必填】 |
openid.op_endpoint | string | 【必填】 |
openid.claimed_id | string | 【必填】 |
openid.identity | string | 【必填】 |
openid.return_to | string | 【必填】 |
openid.response_nonce | string | 【必填】 |
openid.assoc_handle | string | 【必填】 |
openid.signed | string | 【必填】 |
openid.sig | string | 【必填】 |
Epic
Fields | Data Type | Description |
---|
openid | string | 【必填】 用户标识 |
nickname | string | 【选填】 昵称 |
access_token | string | 【必填】 网页用户的访问令牌 |
refresh_token | string | 【选填】 刷新令牌 |
expires_in | uint | 【选填】 访问令牌到期前的时间量 |
refresh_expires_in | uint | 【选填】 刷新令牌到期前的时间量 |
Discord
Fields | Data Type | Description |
---|
access_token | string | 【必填】 网页用户的访问令牌 |
refresh_token | string | 【必填】 刷新令牌 |
expires_in | uint | 【必填】 访问令牌到期前的时间量 |
redirect_uri | string | 【选填】 重定向 URI |
PlayStation5
Fields | Data Type | Description |
---|
code | string | 【必填】 网页用户的访问令牌 |
redirect_uri | string | 【选填】 重定向 URI |
Twitch
Fields | Data Type | Description |
---|
access_token | string | 【必填】 网页用户的访问令牌 |
refresh_token | string | 【必填】 刷新令牌 |
expires_in | uint | 【必填】 访问令牌到期前的时间量 |
token_type | string | 【必填】 的访问令牌类型 eg. "bearer" |
Facebook Instant Game
Fields | Data Type | Description |
---|
signature | string | 【必填】 Facebook 小游戏 signature |
错误码
一、JSSDK 前端错误码
code | Description |
---|
808099001 | 缺少必填参数 |
808099002 | 密码格式非法 |
808099003 | 地区格式非法 |
808099004 | 语言格式非法 |
808099005 | 生日格式非法 |
808098001 | twitter 取消错误码 |
808098002 | Google 登录回调异常 |
808098003 | Line 登录回调异常 |
808098004 | Facebook 登录回调异常 |
808098005 | Twitch 登录回调异常 |
808098006 | Discord 登录回调异常 |
808098007 | Twitter 登录回调异常 |
808098008 | Ps5 登录回调异常 |
808098009 | Apple 登录回调异常 |
808098010 | Epic 登录回调异常 |
808098011 | Epic 取消登录 |
808098012 | Garena 登录回调异常 |
808098013 | Line 取消登录 |
808098100 | 关闭登录弹窗 |
二、后台错误码
1、正常
2、一般错误
code | Description |
---|
101 | inet_aton fail |
102 | HttpsClient fail |
103 | connect network fail |
104 | connect network timeout |
3、请求参数相关(1000 ~ 1099)
code | Description |
---|
1000 | invalid cgi |
1001 | invalid cgi |
1002 | invalid cmd |
1003 | lack parm |
1004 | http body is null |
1005 | http body format error |
1006 | lack param in http body |
1007 | invalid parameter |
1008 | invalid sig |
1009 | invalid param in body |
1010 | invalid req format |
1021 | invalid account type |
1022 | invalid account id |
1023 | invalid uid |
1024 | invalid account platform type |
4、内部错误相关 (1100~1199)
code | Description |
---|
1100 | get ip from l5 fail |
1101 | get ip from dns fail |
1102 | encode fail |
1103 | cal sig fail |
1104 | internal error |
1110 | invalid inet addr |
1111 | invalid json string |
1112 | invalid appid info pls check config appidinfo |
1113 | invalid config appidsecret |
1114 | http Obj internal error |
1199 | other error |
5、权限相关 (1200~1299)
code | Description |
---|
1200 | no permission |
redis 存储相关 (1300~1399) | |
1300 | conn redis fail |
1301 | access redis auth fail |
1302 | conn redis fail ! |
1303 | redis unvalid rsp |
1304 | redis hmset save fail |
1305 | redis del operation fail |
6、自建账号相关
code | Description |
---|
2001 | the account does not exists |
2002 | wrong password |
2003 | the account uid not exists |
2011 | the account is in abnormal status |
2012 | the account is diabled |
2013 | invalid account data in the storage |
2021 | invalid verify_code |
2022 | expired verify_code |
2023 | change password fail |
2101 | invalid token |
2102 | expired token |
2103 | Account params is NULL |
2104 | Account uid is NULL |
2105 | Account phone_area_code is NULL |
2106 | AccountType is NULL |
2107 | Account RandSalt is NULL |
2108 | Account Password is NULL |
2109 | Account save uid is Fail |
2110 | Account saveredis is Fail |
2111 | Account Incr is Err |
2112 | Account is Exist |
2113 | Account Gen Save verify_code Fail |
2114 | invalid verify_code |
2115 | push verifycode Fail |
2116 | Email verify is Fail |
2117 | Params Email Format is Error |
2118 | Params Email is other format |
2119 | send_code type params is error |
2120 | Params password length is error |
2121 | Params password Format is error |
2122 | Params password is other Format |
2123 | request limit |
2124 | limit key len is error |
2125 | logout is fail from cache |
2126 | Phone verify is Fail |
2127 | Params Phone Format is Error |
2128 | Params Phone is other format |
2129 | send sms code network is err |
2130 | send sms code dns is err |
2131 | sendcode http req is fail |
2132 | sendcode http req format is err |
2134 | invalid code_type |
2135 | this application SmsTpl config is err |
2136 | Password cannot be changed to the same password |
2137 | check PngVerifyCode is Failure |
2138 | check Google reCAPTCHA is Failure |
2139 | appinfo donot support this account_plat_type |
2140 | invalid token diff platform |
2141 | diff appid token |
2142 | the same account |
2143 | the account exists |
2144 | change receive email field fail |
2145 | send sms is fail |
2146 | Params username length is error |
2147 | Params username format is err |
2148 | Params birthday length is error |
2149 | Params birthday format is err |
2150 | change profile fail |
2151 | the username is exists |
2152 | Params lang_type length is error |
2153 | Params lang_type format is err |
2154 | no profile params change |
2155 | Params birthday cannot bigger than now time |
2156 | save userinfo to es fail |
2157 | Cannot del account no permission |
2158 | refresh token not support |
2159 | access limit |
2160 | del userinfo to es fail |
2161 | http status code is error |
2162 | invalid response format |
2163 | username in black list |
2164 | username in dirty databases |
2165 | email content length err |
2166 | deliver rsp err |
2167 | lack template name |
2168 | rsa encode err |
2169 | nick name length is error |
2170 | need 2mfa |
2171 | machine type error |
2172 | capthar invalid |