Closed rluders closed 5 years ago
hi I posted 4 requests for you. Next in the JWT class, do the following:
1-
public function refresh($token = false, $forceForever = false, $resetClaims = false)
{
$this->requireToken($token);
return $this->manager->customClaims($this->getCustomClaims())
->refresh($this->token, $forceForever, $resetClaims)
->get();
}
2- protected function requireToken($token = false) { if ($token) { return $this->setToken($token); } elseif (! $this->token) { throw new JWTException('A token is required', 400); } }
Hey, @khorashadi666
Thank you. I'll test and review your PR this weekend. But, so far, looks good.
@khorashadi666 looks like your commit didn't solve the issue. I tested it and it is returning the following error:
The CURL request that I used to test it:
curl -X POST \
http://octobercms.localhost/api/auth/refresh-token \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9vY3RvYmVyY21zLmxvY2FsaG9zdFwvYXBpXC9hdXRoXC9sb2dpbiIsImlhdCI6MTU0MDY0ODkzOSwiZXhwIjoxNTQwNjUyNTM5LCJuYmYiOjE1NDA2NDg5MzksImp0aSI6IkE5M3JqNEpsUEFZdWpHQWYiLCJzdWIiOjEsInBydiI6IjQxMWM5MTdhMGZiNTFlMGE0MjdhN2UzZGVhYTVhNDllMjkyZGRiOWIifQ.UGZvkAqqwWT4-oRUxIFinlNJ-2E8lI8bON7-AtLDKdo' \
-H 'Cache-Control: no-cache' \
-H 'Postman-Token: 6cdface7-2824-4b71-8389-f4a33d171345' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9vY3RvYmVyY21zLmxvY2FsaG9zdFwvYXBpXC9hdXRoXC9sb2dpbiIsImlhdCI6MTU0MDY0ODkzOSwiZXhwIjoxNTQwNjUyNTM5LCJuYmYiOjE1NDA2NDg5MzksImp0aSI6IkE5M3JqNEpsUEFZdWpHQWYiLCJzdWIiOjEsInBydiI6IjQxMWM5MTdhMGZiNTFlMGE0MjdhN2UzZGVhYTVhNDllMjkyZGRiOWIifQ.UGZvkAqqwWT4-oRUxIFinlNJ-2E8lI8bON7-AtLDKdo
Any idea?
For some reason the JWT library can't find the token in the request. Quick fix for this will be to add the following on line 368 in the rluders/jwtauth/http/controllers/AuthController.php:
$this->auth->setToken(input('token'));
I'll try to investigate this issue a little bit more before the end of this year...
The endpoint
/refresh-token
is returning this error.