跳到主要内容

第三方渠道授权(thirdAuthorize)

thirdAuthorize 接口用于获取第三方登录渠道的登录授权信息。通常用于 Player Network 账号登录操作。不同的第三方渠道返回不同的令牌,更多信息请参见 渠道信息。

请求参数​

参数类型描述备注
third_typestring第三方渠道类型:
apple
discord
epic
facebook
fbInstantGame
garena
google
kakaov3
line
ps5
steam
twitch
twitter
vk
xbox
qq
wechat
必填
extraobject特定三方渠道登录时需要的配置
详细配置请参见 extra
选填

extra​

参数类型说明Remark
appleAppIdstringApple 渠道 Web app IDApple 渠道必填
platformnumber指定 Garena 登录的方式
1:Garena
3:Facebook
8:Google
10:Apple
11:Twitter
Garena 渠道选填
grnPromptLoginnumber用户是否每次都需要登录 Garena 账号
0:不需要,1:需要
默认:0
Garena 渠道选填
kakaov3AppIdnumberKakao app IDKakao v3 渠道必填
kakaov3JsKeystringKakao Javascript 密钥Kakao v3 渠道必填
wechatAuthTypenumber0:微信扫码登录,1:微信网页授权
默认:0
微信网页授权必填
wechatAppIdstring微信 AppId微信网页授权必填
wechatScopeTypenumber微信授权 scope type,0:snsapi_login,1:snsapi_userinfo,2:snsapi_base微信网页授权选填

请求示例​

accountApi.thirdAuthorize({
third_type: 'kakaov3',
extra: {
kakaov3AppId: 111, // Required for kakao v3 login
kakaov3JsKey: 'xxx', // Required for kakao v3 login
}
}).then(
(res) => {
console.log(res);
});
accountApi.thirdAuthorize({
third_type: 'apple',
extra: {
appleAppId: 'xxxxx', // Required for apple login
}
}).then(
(res) => {
console.log(res);
});
accountApi.thirdAuthorize({
third_type: 'garena',
extra: {
grnPromptLogin: 1, // user needs to log in every time
}
}).then(
(res) => {
console.log(res);
});

返回参数​

参数类型描述
retnumber返回代码
0:请求成功
!=0:请求失败,查看 msg 详细结果说明
msgstring结果说明
access_tokenstring渠道访问令牌
不同的第三方渠道返回不同的令牌,详见 渠道信息。

返回示例​

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