Open ampedweb opened 3 years ago
I'm also facing the same problem. Don't know what could be the possible issue.
Also they haven't updated the document since long time.
There is a contruct in AuthController on the docs if you scroll down a little
/**
* Create a new AuthController instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth:api', ['except' => ['login']]);
}
Subject of the issue
I've been having problems with getting a token to reliably refresh in my Nuxt PWA application I'm writing.
I believe it's possibly down to the documentation here:
https://jwt-auth.readthedocs.io/en/develop/quick-start/#add-some-basic-authentication-routes
I believe the above should be something more like:
Note the added middleware exclusions, mainly on the refresh route.
(This is my code and appears to fix my issue, feel free to make it more generic).
Perfectly happy to accept I'm missing something but thought this might help others down the line if the Docs are indeed off! :-)
Thanks!
Your environment
Steps to reproduce
Follow the quick start documentation then try using the Laravel JWT provider on this Nuxt module here: https://dev.auth.nuxtjs.org/providers/laravel-jwt (The suggested routes for Laravel were only recently added it seems, which is how I just fixed my issue)
Expected behaviour
My token should be reissued if a refresh has been requested within the specified time frame of 2 weeks
Actual behaviour
I get a 401 unauthorised response from the Laravel API