Loading... 关于苹果授权,官方文档写的不仔细,但还是要看一下 https://developer.apple.com/sign-in-with-apple/get-started/ ### 后端验证苹果授权用户正确性有两种方式,如下: 利用 identity_token 与 user_id 进行校验,匹配成功,即证明 user_id 是正确的唯一标识。 利用授权 code,加生成 client_secret,进行授权验证。 ### 一、验证 identity_token 与 user_id (建议使用,方便) 安装PHP扩展包(支持php5.6及以上):composer require wubuwei/php-apple-signin 使用方式见:https://github.com/wubuwei/php-apple-signin 相比于fork的仓库:增加了抛错文件;修复了苹果验证链接返回参数无序导致的偶尔验证失败的情况。 参考链接: https://developer.apple.com/documentation/sign_in_with_apple https://blog.csdn.net/u013862108/article/details/102890808 二、验证授权 code 生成 client_sercret,用于解密参数,暂时使用 ruby 的文件进行生成,有兴趣可以用PHP 实现一套,下面操作前请先了解这篇:https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple#create-a-private-key-for-client-authentication ```apache /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" a. mac 电脑安装 ruby 环境+ ruby-jwt 扩展:brew install ruby 、sudo gem install jwt b. 配置 client-secret.rb 参数。 c. 执行命令:ruby client-secret.rb 文件 生成 token,即后端解密用的 client_sercret ``` 原文链接:https://blog.csdn.net/curioust/java/article/details/105353930 如何解密 code: https://github.com/aaronpk/sign-in-with-apple-example 此篇可能是网上最广泛的教程,index.php 内的方法可以看到解密 code 后的参数 [备份](https://blog.wxhbts.pro/usr/uploads/2021/04/2786867084.zip) Last modification:October 1, 2022 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 如果觉得我的文章对你有用,请随意赞赏