I've upgraded my project on Laravel 5.2 to Laravel 5.3 to use Laravel passport for api routes.
After couple of weeks I still can't get tokens to work, I always get an unauthenticated error.
After all investigations I've started debugging Laravel Passport and understand that my problem is here (\vendor\lcobucci\jwt\src\Parser.php):
protected function splitJwt($jwt)
{
if (!is_string($jwt)) {
throw new InvalidArgumentException('The JWT string must have two dots');
}
$data = explode('.', $jwt);
if (count($data) != 3) {
throw new InvalidArgumentException('The JWT string must have two dots');
}
return $data;
}
Tokens that I get from
$this->user->createToken($this->user->id.' Access Token')->accessToken;
Just have no dots, so can't be exploded. I don't know why, but think that it is the main question.
Typical token that I get looks like this one: 1369781b342d5181072c7f2859a54102f1dc992f6367c4b8ac37193799ec893438ad1b6ac43af3ae
Can somebody help me with this problem?
Thanks in advance
'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'passport', 'provider' => 'users', ], ],'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'passport', 'provider' => 'users', ], ],` - Вася Аристов