Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get property 'id' of non-object on passport after createToken()

when i using passport package After doing this,

$success['token'] =  $users->createToken('MyApp')->accessToken;

I'll deal with error in this code :

  protected function createRequest($client, $userId, array $scopes)
{
    return (new ServerRequest)->withParsedBody([
        'grant_type' => 'personal_access',
        'client_id' => $client->id,
        'client_secret' => $client->secret,
        'user_id' => $userId,
        'scope' => implode(' ', $scopes),
    ]);
}

text of error :

Trying to get property 'id' of non-object

why clinet variabale has null ??

like image 320
reza baghiee Avatar asked Apr 18 '18 17:04

reza baghiee


1 Answers

I had the same issue when i upgraded to ^3.0. I ran php artisan passport:install --force to regenerate keys and it worked.

like image 127
Emmanuel Barturen Avatar answered Sep 24 '22 02:09

Emmanuel Barturen