dongquweng5152 2017-02-04 06:06
浏览 80
已采纳

使用基本身份验证整合Laravel Socialite facebook登录

Already I have integrated the Laravel default Auth in my application now I want to integrate social logins with it.

Here is the work flow

1.get user details(social_id,name,email,profile_pic) from socialite

2.check the user existence with email ,if its exists execute auth::login, otherwise create a new record in users table and redirect to profile.

When a user remove email-id during Facebook auth Approval page I will get

$user-getEmail() as null so in this case above workflow is not applicable since everything is depend on user email so how can I handle this situation

  • 写回答

1条回答 默认 最新

  • dongwo8827523 2017-02-04 06:45
    关注

    since everything is depend on user email

    Well that's the problem. You need to be able to handle Facebook users without email addresses. So on login, instead of checking for users' existence based on email, check:

    • If the provider is Facebook, check based on User->getId()
    • Otherwise, check based on email

    See this tutorial for some further code samples.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘