wx.appleLogin
调用 JSAPI 进行 Apple 登录open in new window,获取临时登录凭证 (code),通过凭证进而换取用户标识信息等。
注:该接口不支持在「移动应用助手」中调试,开发者需构建 ipa 安装到手机后才能调试
前置准备
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|
| success | function | | 否 | 接口调用成功的回调函数 |
| fail | function | | 否 | 接口调用失败的回调函数 |
| complete | function | | 否 | 接口调用结束的回调函数 |
object.success 回调函数
参数
Object res
object.fail 回调函数
参数
Object res
| 属性 | 类型 | 说明 |
|---|
| errCode | number | 错误码 |
| errMsg | string | 错误提示 |
res.errCode
| errCode | 说明 |
|---|
| -1 | system error |
| 10001005 | 多端应用未接入身份管理 |
| 10001009 | Apple 登录未配置 |
| 10001010 | Apple 登录配置错误 |
| 10001020 | 请求Apple服务失败, 请稍后重试 |
| -700000 | 前端错误,errMsg 将给出详细提示 |
示例代码
wx.appleLogin({
success (res) {
if (res.code) {
wx.request({
url: 'https://example.com/onLogin',
data: {
code: res.code
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})