Laravel 5.4:社交名不记录

问题描述:

我使用Socialite在我的平台上登录社交网络。 数据插入到我的数据库,但我没有登录?Laravel 5.4:社交名不记录

这是我的控制器:

$socialProvider = SocialProvider::where('provider_id',$socialUser->getId())->first(); 
$user = $socialProvider->user; 
    dd($user); 
    auth()->login($user); 

的DD($用户)给我:

User {#548 ▼ 
    #table: "users" 
    #guarded: array:1 [▶] 
    #fillable: array:24 [▶] 
    #hidden: array:2 [▶] 
    #dates: array:1 [▶] 
    #persistableKey: "user_id" 
    #persistableRelationship: "persistences" 
    #loginNames: array:1 [▶] 
    #connection: null 
    #primaryKey: "id" 
    #keyType: "int" 
    +incrementing: true 
    #with: [] 
    #perPage: 15 
    +exists: true 
    +wasRecentlyCreated: false 
    #attributes: array:26 [▶] 
    #original: array:26 [▶] 
    #casts: [] 
    #dateFormat: null 
    #appends: [] 
    #events: [] 
    #observables: [] 
    #relations: [] 
    #touches: [] 
    +timestamps: true 
    #visible: [] 
    #permissionsInstance: null 
    #rememberTokenName: "remember_token" 
    #forceDeleting: false 
} 

我改变登录电话:Auth :: login($ user,true);但仍然无法正常工作。

呼叫门面Auth::login($user, true);

更新:看了一下我自己的代码在使用社交名流。我不得不把用户从用户表中拉出来,而不是通过雄辩的关系。不知道为什么。就我而言,我保存Facebook的帐号到用户表:

Auth::loginUsingId($user->id); 

你有没有在你的配置设置/ Auth.php在auth右表:

$user = User::where('facebook_id', $socialProvider->id)->first(); 
Auth::login($user, true); 
+0

已经尝试过。 – Kaherdin

你可以试试吗?

+0

仍然无法正常工作。我没有触摸我的配置/ auth.php – Kaherdin

+0

你是如何“用户”表? – mrfr34k

+0

https://snag.gy/0TXOgx.jpg – Kaherdin