使用Gmail登录时从社交名流获取电子邮件地址

编程入门 行业动态 更新时间:2024-10-28 17:26:15
本文介绍了使用Gmail登录时从社交名流获取电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在关注这篇文章,以 使用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登录时从社交名流获取电子邮件地址

本文发布于:2023-07-15 01:52:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1108312.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:名流   社交   电子邮件地址   Gmail

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!