我正在关注这篇文章,以 使用Google登录 .我能够成功重定向到gmail登录.此外,它会成功转到回调URL.
I am following this article to login with Google. I am able to redirect to gmail login successfully. Also, it goes to callback url successfully.
下面是我的代码
public function showGoogleLoginForm() { $providerKey = \Config::get('services.google'); return \Socialite::driver( 'google' )->scopes(['profile', 'email'])->redirect(); }问题
我现在正在尝试检查回调是否为我提供了用户的电子邮件地址.这样,我可以检查用户是否在我的数据库中注册.
I am now trying to check if the callback gives me the email address of the user or not. So that, I could check that user is registered in my database or not.
有没有办法在回调中获取电子邮件地址?
Is there any way to get the email address in the callback?
我能够将用户重定向到gmail登录,也可以使用回调方法.在回调方法中,此代码出现错误:\Socialite::driver( 'google' )->user()
I am able to redirect user to gmail login and also I am able to reach my callback method. In the callback method I got error on this code: \Socialite::driver( 'google' )->user()
当我使用此代码时,我得到了这个 错误 \Socialite::driver( 'google' )->user();
I got this Error when i used this code \Socialite::driver( 'google' )->user();
推荐答案我必须启用Google + API才能消除此错误.现在一切正常.
I had to enable Google + API to get rid of this error. Everything is working perfectly now.
更多推荐
使用Gmail登录时从社交名流获取电子邮件地址
发布评论