【发布时间】:2017-10-16 16:38:21
【问题描述】:
我通过我验证的 RESTful API 进行身份验证,如果它成功,它会给我用户名,我接受它并尝试登录到我的 Laravel 应用程序。当我完成登录时,它似乎工作。但是,当我在网站上导航时,它似乎没有保持会话,我仍然以访客身份进行身份验证。
public function login(){
// I do a guzzle request that gives me the value of $response['username']
$Username = $response['username'];
$user = User::where('username','thomc')->first();
Auth::login($user);
return view('home');
}
这是我的用户模型:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
protected $table = 'UserDetails';
}
我的桌子:
- 用户名
- 电子邮件
- 名字
- 姓氏
- 巴
- Facebook_ID
- Google_ID
【问题讨论】:
标签: php laravel authentication laravel-5.4