New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@intlsdk/account-api

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlsdk/account-api

> 目前已支持`npm包`方式和`CDN`方式

  • 1.5.0
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
72
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Account-API WEB 集成教程

快速使用

第一步:引入 SDK

目前已支持npm包方式和CDN方式

npm 方式

$ npm install @intlsdk/account-api

CDN 方式

//联调环境SDK包
<script src="https://test-common-web.intlgame.com/sdk-cdn/account-api/index.umd.js"></script>

//现网环境SDK包
<script src="https://common-web.intlgame.com/sdk-cdn/account-api/index.umd.js"></script>

第二步:使用 SDK

参数说明

ParameterTypeDescription
envstringSDK 运行环境,详见下“env 说明”
langTypestring语言类型
appIDstringApp ID
accountPlatTypenumber自建账号平台类型
gameIDnumberINTL 游戏唯一标识 ID

env 说明:

测试联调阶段,提供联调环境:
统一联调:'test'
LonelyFish 联调:us-test

现网环境(正式环境):
新加坡:'sg'
北美:'na'
欧洲:'eu'
LonelyFish:'lonelyfish'

实例化对象

调用不同功能 API,实例化对象入参会有不同,具体入参说明如下:

1、自建账号相关

const accountApi = new IntlgameAccountApi({
  env: 'test', //sdk运行的环境,详见下“env说明”:)
  langType: 'en', //语言
  appID: '', //自建账号appid
  accountPlatType: 52, //自建账号平台id
  gameID: 11,
});

2、第三方渠道相关

const accountApi = new IntlgameAccountApi({
  env: 'test', //sdk运行的环境,详见下“env说明”:)
  gameID: 11,
});

API 说明文档

一、自建账号相关

1、自建账号登录

signIn

自建账号密码登录

Request parameters:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
passwordstring【必填】密码
phone_area_codestring【account_type=2 时必填】手机区号
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstring用户授权令牌
uidstring帐户的 UID
seqstring数据流消息序号
expireint64令牌过期时间

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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】手机区号
verify_codestring【必填】验证码
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstring用户授权令牌
uidstring帐户的 UID
seqstring数据流消息序号
expireint64令牌过期时间

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID
account_plat_typestring【必填】自建账号平台类型,用于识别不同的账户平台

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstringINTL 生成的用户授权令牌,长度 40 字节
openidstringINTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位。
token_expire_timeint64INTL token 过期时间
user_namestring用户名
birthdaystring生日
channel_infoobject登录 INTL 的渠道信息
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
account_typenumber账号类型
birthdaystring生日
emailstring邮箱
expireint64token 过期时间
is_receive_emailnumber是否接收邮件推送
1:推送
其他:不推送
lang_typestring语言
nick_namestring昵称
privacy_policystring用户隐私政策版本
privacy_update_timeint64用户隐私政策更新时间
regionstring地区
terms_of_servicestring用户服务条款版本
terms_update_timeint64用户服务条款更新时间
uidstring帐户的 UID
user_namestring用户名
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID
user_namestring【选填】用户名,不可重复
nick_namestring【选填】 用户昵称,可重复
birthdaystring【选填】用户生日
regionstring【选填】国家地区码,引用 ISO_3166-1 标准,对应的三位数字码

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
birthdaystring生日
emailstring邮箱
is_receive_emailnumber是否接收邮件推送
1:推送
其他:不推送
lang_typestring语言
nick_namestring昵称
phonestring手机号码
phone_area_codestring手机区号
regionstring地区
seqstring数据流消息序号
user_namestring用户名

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:

ParameterTypeDescription
user_namestring【必填】用户名

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号
username_availablestring用户名是否可用
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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID
privacy_policystring【必填】隐私政策版本号(不能设置成之前已经设置过的版本,只能升级版本)
terms_of_servicestring【必填】服务条款版本号(不能设置成之前已经设置过的版本,只能升级版本)

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
privacy_policystring用户隐私政策版本
terms_of_servicestring用户服务条款版本
seqstring数据流消息序号

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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】手机区号

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
is_registernumber账号是否存在
0:不存在
1:存在
seqstring数据流消息序号

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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】手机区号
passwordstring【必填】密码
user_namestring【选填】用户名,不可重复
nick_namestring【选填】用户昵称,可重复
birthdaystring【选填】用户生日
regionstring【选填】国家地区码,引用 ISO_3166-1 标准,对应的三位数字码
is_receive_emailnumber【选填】是否接收邮件推送
1:推送
其他:不推送
verify_codestring【是否必填受管理端自建账号登录配置控制】验证码
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstring用户授权令牌
uidstring帐户的 UID
seqstring数据流消息序号
expireint64令牌过期时间

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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】手机区号
passwordstring【选填】 密码
user_namestring【选填】 用户名,不可重复
nick_namestring【选填】 用户昵称,可重复
birthdaystring【选填】 用户生日
regionstring【选填】 国家地区码,引用 ISO_3166-1 标准,对应的三位数字码
is_receive_emailnumber【选填】 是否接收邮件推送
1:推送
其他:不推送
verify_codestring【必填】验证码
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstring用户授权令牌
uidstring帐户的 UID
seqstring数据流消息序号
expireint64令牌过期时间

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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】 手机区号【account_type=2 时必填】
code_typenumber【必填】生成的验证码类型
0:注册
1:修改密码
2:登录、验证码注册
3:修改主体注册账号
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
expire_timenumber验证码过期时间,单位:秒(s)
seqstring数据流消息序号

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:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
sessionidstring图形验证码 sessionid
urlstring图形验证码 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:

ParameterTypeDescription
accountstring【必填】账号,邮箱或手机号(暂不支持手机
account_typenumber【必填】账号类型
1:email
2:phone
phone_area_codestring【account_type=2 时必填】手机区号
passwordstring【必填】新密码
verify_typenumber【必填】验证方式
1:使用验证码
2:使用旧密码
old_passwordstring【verify_type=2 时必填】旧密码
verify_codestring【verify_type=1 时必填】验证码
machine_check_typenumber【是否必填受管理端自建账号登录配置控制】人机识别方式
1:图形验证码
2:google 人机识别
3:tencent 人机识别
png_verify_codestring【machine_check_type=1 时必填】 图形验证码
session_idstring【machine_check_type=1 时必填】图形验证码 session_id(在调用 requestVerifyImage 方法获取图形验证码时返回)
google_responsestring【machine_check_type=2 时必填】google 人机识别返回的 response token ,例如:
03AGdBq2475OG47Cl06wIHd...Dt_NXH-EzDztpqrrBrw
tencent_responsestring【machine_check_type=3 时必填】tencent 人机识别返回值 ,需要转成字符串,如:
JSON.stringify({"appid":"xxx","ret":0,"ticket":"t030...ECE*","randstr":"@BHo"})

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
uidstring【必填】自建账号,帐户 UID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
third_typestring【必填】第三方渠道类型
steam
facebook
google
twitch
ps5
twitter
discord
epic
line
apple

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
access_tokenstring渠道访问令牌

Demo

api.thirdAuthorize({
    third_type:'facebook'
}).then(
    (res) => {
        console.log(res);
    }
);

response log:
{
    msg: "Success",
    ret: 0,
    access_token: "xxxxx",
}

intlAuthorize

INTL 账号授权

Request parameters:

ParameterTypeDescription
third_typestring【必填】第三方渠道类型
steam
facebook
google
twitch
ps5
twitter
discord
epic
line
apple

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
tokenstringINTL 生成的用户授权令牌,长度 40 字节
openidstringINTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位。
token_expire_timeint64INTL token 过期时间
user_namestring用户名
birthdaystring生日
channel_infoobject登录 INTL 的渠道信息
seqstring数据流消息序号

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

ParameterTypeDescription
third_typestring【必填】第三方渠道类型 facebook
app_idstring【必填】申请 facebook 应用的唯一标识符
hrefstring【必填】对此帖子附加的链接
hashtagstring【选填】开发人员指定的要添加到分享内容中的话题标签
quotestring【选填】要与链接一起分享的语录,由用户突出显示或由开发者预先指定,例同对某一文章的醒目引述
displaystring【选填】对话框呈现方式
page
iframe
popup
touch
redirect_uristring【选填】用户点击对话框中的按钮后重新定向到此网址

twitter

ParameterTypeDescription
third_typestring【必填】第三方渠道类型 twitter
urlstring【选填】共享 URL, 将在已发布的推文中自动缩短。 共享 URL 可能会出现一张卡片。
viastring【选填】使用 via 参数@用户
textstring【选填】文本参数显示在推文编辑器中预选。 推文作者可以通过单个删除操作轻松删除文本
hashtagsstring【选填】使用 hashtags 参数向推文添加逗号分隔的主题标签列表

vk

ParameterTypeDescription
third_typestring【必填】第三方渠道类型 vk
urlstring【必填】分享链接
descriptionstring【选填】描述
imagestring【选填】图片地址
titlestring【选填】标题

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:

ParameterTypeDescription
tokenstring【必填】INTL 生成的用户授权令牌,长度 40 字节
openidstring【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位
oauth_channelidnumber【必填】发起绑定的 INTL 授权渠道 ID
bind_channel_infoobject【必填】被绑定渠道的登录信息,不同渠道内容不同
bind_channelidnumber【必填】被绑定渠道的 INTL 授权渠道 ID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】INTL 生成的用户授权令牌,长度 40 字节
openidstring【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位
oauth_channelidnumber【必填】发起解除绑定的 INTL 授权渠道 ID
unbind_channelidnumber【必填】被解除绑定渠道的 INTL 授权渠道 ID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】INTL 生成的用户授权令牌,长度 40 字节
openidstring【必填】INTL 用户唯一标识,默认为 64 bit 无符号整数的字符串,也可以支持 32 位
channel_idnumber【必填】INTL 授权渠道 ID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
bind_listarray绑定列表
seqstring数据流消息序号

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:

ParameterTypeDescription
channel_idnumber【必填】INTL 授权渠道 ID
channel_infoobject【必填】渠道的登录信息,不同渠道内容不同

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
bind_listarray绑定列表
seqstring数据流消息序号

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:

ParameterTypeDescription
third_typestring【必填】第三方渠道类型
steam
facebook
google
twitch
ps5
discord
epic
channel_infoobject【必填】渠道的登录信息,不同渠道内容不同
sacc_channel_infoobject【必填】自建账号的登录信息

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID
unmap_channelidnumber【必填】解除映射的 INTL 授权渠道 ID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
seqstring数据流消息序号

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:

ParameterTypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
uid_listarray映射渠道 uid 列表
seqstring数据流消息序号

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:

ParameterTypeDescription
third_typestring【必填】第三方渠道类型
steam
facebook
google
twitch
ps5
discord
epic
channel_infoobject【必填】渠道的登录信息,不同渠道内容不同

Response parameters:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
sacc_uidstring自建账号 uid
need_authboolean是否需要登录自建账号
seqstring数据流消息序号

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:

ParameterTypeDescription
retnumber结果返回码
0:请求成功,可以解析相关返回字段信息
!=0:请求逻辑失败, msg 里面有具体错误信息
msgstring结果说明
alpha2string国家地区代码,2 位代码 ISO 3166-1 标准
regionstring国家地区代码,3 位数字代码 ISO 3166-1 标准
timestampnumberUnix 时间戳
seqstring数据流消息序号

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 说明

ChannelChannelid
guest3
facebook4
google6
twitter9
garena10
line14
apple15
steam21
epic24
discord26
ps527
twitch28

二、Channel Info 说明

Custom Account

FieldsData TypeDescription
tokenstring【必填】自建账号,用户授权令牌
openidstring【必填】自建账号,帐户 UID
account_plat_typestring【必填】自建账号平台类型,用于识别不同的账户平台

Facebook

Classic Facebook Login

FieldsData TypeDescription
access_tokenstring【必填】 网页用户的访问令牌

Google

FieldsData TypeDescription
codestring【必填】 可用于获取访问令牌的授权码

Twitter

FieldsData TypeDescription
oauth_tokenstring【必填】 网页用户的访问令牌
oauth_secretstring【必填】 网页用户的访问口令密钥

Line

FieldsData TypeDescription
access_tokenstring【必填】 网页用户的访问令牌
expires_inint64【选填】访问令牌到期前的时间量(以秒为单位)

Apple

FieldsData TypeDescription
codestring【必填】可用于获取访问令牌的授权码
user_namestring【选填】渠道返回用户名

VK

FieldsData TypeDescription
tokenstring【必填】 网页用户的访问令牌

Steam

FieldsData TypeDescription
openid.nsstring【必填】
openid.modestring【必填】
openid.op_endpointstring【必填】
openid.claimed_idstring【必填】
openid.identitystring【必填】
openid.return_tostring【必填】
openid.response_noncestring【必填】
openid.assoc_handlestring【必填】
openid.signedstring【必填】
openid.sigstring【必填】

Epic

FieldsData TypeDescription
openidstring【必填】 用户标识
nicknamestring【选填】 昵称
access_tokenstring【必填】 网页用户的访问令牌
refresh_tokenstring【选填】 刷新令牌
expires_inuint【选填】 访问令牌到期前的时间量
refresh_expires_inuint【选填】 刷新令牌到期前的时间量

Discord

FieldsData TypeDescription
access_tokenstring【必填】 网页用户的访问令牌
refresh_tokenstring【必填】 刷新令牌
expires_inuint【必填】 访问令牌到期前的时间量
redirect_uristring【选填】 重定向 URI

PlayStation5

FieldsData TypeDescription
codestring【必填】 网页用户的访问令牌
redirect_uristring【选填】 重定向 URI

Twitch

FieldsData TypeDescription
access_tokenstring【必填】 网页用户的访问令牌
refresh_tokenstring【必填】 刷新令牌
expires_inuint【必填】 访问令牌到期前的时间量
token_typestring【必填】 的访问令牌类型 eg. "bearer"

Facebook Instant Game

FieldsData TypeDescription
signaturestring【必填】 Facebook 小游戏 signature

错误码

一、JSSDK 前端错误码

codeDescription
808099001缺少必填参数
808099002密码格式非法
808099003地区格式非法
808099004语言格式非法
808099005生日格式非法
808098001twitter 取消错误码
808098002Google 登录回调异常
808098003Line 登录回调异常
808098004Facebook 登录回调异常
808098005Twitch 登录回调异常
808098006Discord 登录回调异常
808098007Twitter 登录回调异常
808098008Ps5 登录回调异常
808098009Apple 登录回调异常
808098010Epic 登录回调异常
808098011Epic 取消登录
808098012Garena 登录回调异常
808098013Line 取消登录
808098100关闭登录弹窗

二、后台错误码

1、正常

codeDescription
0success

2、一般错误

codeDescription
101inet_aton fail
102HttpsClient fail
103connect network fail
104connect network timeout

3、请求参数相关(1000 ~ 1099)

codeDescription
1000invalid cgi
1001invalid cgi
1002invalid cmd
1003lack parm
1004http body is null
1005http body format error
1006lack param in http body
1007invalid parameter
1008invalid sig
1009invalid param in body
1010invalid req format
1021invalid account type
1022invalid account id
1023invalid uid
1024invalid account platform type

4、内部错误相关 (1100~1199)

codeDescription
1100get ip from l5 fail
1101get ip from dns fail
1102encode fail
1103cal sig fail
1104internal error
1110invalid inet addr
1111invalid json string
1112invalid appid info pls check config appidinfo
1113invalid config appidsecret
1114http Obj internal error
1199other error

5、权限相关 (1200~1299)

codeDescription
1200no permission
redis 存储相关 (1300~1399)
1300conn redis fail
1301access redis auth fail
1302conn redis fail !
1303redis unvalid rsp
1304redis hmset save fail
1305redis del operation fail

6、自建账号相关

codeDescription
2001the account does not exists
2002wrong password
2003the account uid not exists
2011the account is in abnormal status
2012the account is diabled
2013invalid account data in the storage
2021invalid verify_code
2022expired verify_code
2023change password fail
2101invalid token
2102expired token
2103Account params is NULL
2104Account uid is NULL
2105Account phone_area_code is NULL
2106AccountType is NULL
2107Account RandSalt is NULL
2108Account Password is NULL
2109Account save uid is Fail
2110Account saveredis is Fail
2111Account Incr is Err
2112Account is Exist
2113Account Gen Save verify_code Fail
2114invalid verify_code
2115push verifycode Fail
2116Email verify is Fail
2117Params Email Format is Error
2118Params Email is other format
2119send_code type params is error
2120Params password length is error
2121Params password Format is error
2122Params password is other Format
2123request limit
2124limit key len is error
2125logout is fail from cache
2126Phone verify is Fail
2127Params Phone Format is Error
2128Params Phone is other format
2129send sms code network is err
2130send sms code dns is err
2131sendcode http req is fail
2132sendcode http req format is err
2134invalid code_type
2135this application SmsTpl config is err
2136Password cannot be changed to the same password
2137check PngVerifyCode is Failure
2138check Google reCAPTCHA is Failure
2139appinfo donot support this account_plat_type
2140invalid token diff platform
2141diff appid token
2142the same account
2143the account exists
2144change receive email field fail
2145send sms is fail
2146Params username length is error
2147Params username format is err
2148Params birthday length is error
2149Params birthday format is err
2150change profile fail
2151the username is exists
2152Params lang_type length is error
2153Params lang_type format is err
2154no profile params change
2155Params birthday cannot bigger than now time
2156save userinfo to es fail
2157Cannot del account no permission
2158refresh token not support
2159access limit
2160del userinfo to es fail
2161http status code is error
2162invalid response format
2163username in black list
2164username in dirty databases
2165email content length err
2166deliver rsp err
2167lack template name
2168rsa encode err
2169nick name length is error
2170need 2mfa
2171machine type error
2172capthar invalid

FAQs

Package last updated on 13 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc