跳到主要内容

三方渠道登录

警告

LI PASS Web 登录第三方渠道仅支持系统浏览器,任何游戏或应用的内置 WebView 组件均不支持第三方渠道登录:

  • 基于安全考量,Google 和 Facebook 完全禁止在内置 WebView 使用网页登录
  • WebView 组件不能同时加载两个页面,这意味着它无法加载第三方登录页面来完成登录过程

要支持第三方渠道登录,请在 Player Network 控制台上设置第三方渠道。以 Facebook 为例 配置指引 —— Facebook

LI PASS Web 组件支持使用三方渠道登录。

LI PASS Web 组件目前支持 Apple、Discord、Epic、Facebook、Google、LINE、PS5、Steam、Twitch、Twitter、VK。

<div id="infinite-pass-component"></div>
const pass = new PassFactory.Pass({
env: "test", // 环境
gameID: "", // 游戏 ID
appID: "", // 账号 App ID

config: {
socialList: ['facebook', 'twitter']
}
});

// 调用 `Start` 将组件挂载到指定的 DOM 节点
// 登录成功后 登录结果在 intlSignResp
pass.start("#infinite-pass-component").then((userInfo) => {
console.log("userInfo: ", userInfo);
});

关键配置参数

参数类型描述备注
socialListstring[]第三方渠道类型:
apple
discord
epic
facebook
google
line
ps5
steam
twitch
twitter
vk
选填

返回参数

参数类型描述
retnumber返回代码
0:请求成功
!=0:请求失败,查看 msg 详细结果说明
msgstring结果说明
tokenstringPlayer Network SDK 生成的用户 token
长度:40字节,详见 Token
openidstringPlayer Network SDK 用户唯⼀标识
默认为 64-bit 无符号整数的字符串,也可以支持 32-bit
token_expire_timeint64Player Network SDK token 过期时间
Unix 时间
user_namestring用于登录的用户名
birthdaystring用户生日
channel_infoobject登录渠道的渠道信息
更多信息,请参见 渠道信息
del_account_statusnumber账号注销状态
-1:查询失败
0:未撤回任何注销账号记录或删除号码 (邮件或手机账号)
1:账号注销前的静默期
2:已经成功注销账号
3:正在注销账号
4:注销账号失败
seqstring数据流消息序号

返回示例

{
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-xxxxxxxxxxxxxxxx-419213088809929925",
pf_key: "6cc9bxxxxxxxxxxxxxxxxxx826",
picture_url: "https://www.google.com/Images/profileA.png",
ret: 0,
seq: "1638935899-1006943754-018668-0000656615",
token: "xxx",
token_expire_time: 1641527900,
del_account_status: 0,
uid: "xxxx",
user_name: "user",
}