jeudi 28 mai 2020

Laravel custom auth based on json data

I am trying to make auth based on third party api in laravel. not storing or using data from my local db. Here I am keeping api response data as an array just for visualization . It shows error Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, string given, called in vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php . How can I fix that. I also made R&D on it. Thanks in advance

    $user = [
        'status' => '200',
        'token' => 'aWsIpvOEZfv4sfSRUGS2dDeGw7',
        'id' => '12454545412',
        'user' => [
            'name' => 'xyz',
            'email' => 'xyz@gmail.com',
            'phone' => '12344787',
        ],
    ];

    $user = json_encode($user);
    Auth::login($user);
    return redirect( '/home' );


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3c3Pgty
via IFTTT

Aucun commentaire:

Enregistrer un commentaire