I'm trying to install jwt authentication in laravel, but I'm using laravel 5.8 and JWT, following this https://tutsforweb.com/restful-api-in-laravel-56-using-jwt-authentication/ , but display me this error.
There is any problem in my vendor/tymon/jwt-auth/src/jwt.php
between line 182 200
public function parseToken()
{
if (! $token = $this->parser->parseToken()) {
throw new JWTException('The token could not be parsed from the request');
}
return $this->setToken($token);
}
well and I found this suggestion and I followed this Laravel - JWT Auth The token could not be parsed from the request
public function parseToken($method = 'bearer', $header = 'authorization', $query = 'token')
{
if (! $token = $this->parseAuthHeader($header, $method)) {
if (! $token = $this->request->query($query, false)) {
throw new JWTException('The token could not be parsed from the request', 400);
}
}
return $this->setToken($token);
}
/**
* Parse token from the authorization header.
*
* @param string $header
* @param string $method
*
* @return false|string
*/
protected function parseAuthHeader($header = 'authorization', $method = 'bearer')
{
$header = $this->request->headers->get($header);
if (! starts_with(strtolower($header), $method)) {
return false;
}
return trim(str_ireplace($method, '', $header));
}
how can I change this?
ErrorException : Undefined property: Tymon\JWTAuth\JWTAuth::$request at C:\laragon\www\ecommerce\vendor\tymon\jwt-auth\src\JWT.php:203