Sign in with Apple ID 偶尔会报错: JsonWebTokenError
首先在苹果官方文档中指出:凡事具有第三方账号登录的应用在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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论