Sign in with Apple ID 偶尔会报错: JsonWebTokenError

发布于 2022-09-12 03:13:58 字数 1099 浏览 47 评论 0

首先在苹果官方文档中指出:凡事具有第三方账号登录的应用在2020年6月30日前必须增加 Sign in with Apple ID 功能,否则不能通过AppStore的审核。

Apps that use a third-party or social login service to set up or authenticate the user’s primary account with the app must also offer Sign in with Apple as an equivalent option. As you plan and design your app or website for Sign in with Apple, make sure to follow these guidelines. In addition, the Human Interface Guidelines include downloadable left-aligned, center-aligned, and logo-only buttons. App updates must follow these guidelines starting June 30, 2020.

但是我在实现此功能的最后一步——将客户端获取的信息发送至服务器校验时偶尔会出现 JsonWebTokenError: invalid signature 报错,错误率高时会接近50%。

我尝试来两种校验方式都一样
第一种是,在iOS客户端获取用户的identity, 发送到自己的服务器。在服务起请求 https://appleid.apple.com/auth/keys 接口,得到public key 后用 jwt.verify 校验
另一种是,在iOS客户端获取用户的code, 发送到自己的服务器,在服务器先请求 https://appleid.apple.com/auth/token 获取到 token, 并同样用 https://appleid.apple.com/auth/keys 接口,得到public key 后用 jwt.verify 校验

这两种方式的通过率都在50%左右,所以还不敢上线。不知道大家有没有遇到同样的问题,又是怎样决绝的?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文