https://github.com/laravel/socialite
这是官方的第三方登录包,支持很多国外的第三方登录
https://github.com/overtrue/socialite 安正超写的作示范:
这里使用github登录作为演示:
首先在github账户上获得Client ID和Client Secret
github()方法是使页面重定向到授权页面:githublogin()是在后台匹配 Client ID和Client Secret ,匹配成功则正常登录,失败则返回
对于上面的实现流程,在实际的项目开发中,我们的最佳实践如下:
其中$config属性中的数据我们一般存放在/config/services.php中