So, I saw like 101% of the issues about this and did try each and every single one of them. I'm trying to get it running for like 3 days with no success. The person I work with on the project is ding the exact same thing and it's working for him.
I have set the routes,
I have\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, in my middlewareGroups->web,
I am sending the headers with the requests,
I have protected static $serialize = true; in EncryptCookies,
Here's an example
X-CSRF-TOKEN: 8Gr7XcRZDrfiFIwqaPyqVF1stXdIxv1tQ4Up6JUr
X-Requested-With: XMLHttpRequest
X-XSRF-TOKEN: eyJpdiI6ImU3RFRTRlNNd2hRc0J3bU9qb2l2UGc9PSIsInZhbHVlIjoiaWJnd1wvWTdteW1Cd2w5Zll2SmYwdkplQ094R05HUzZPckM0NUNrdFB5alNpTDduWHkxczZWcU5maW9WS1VnRk9RZGZqdGJQM1FXR29JMFhDS2RyMTVBPT0iLCJtYWMiOiI4YmRmMWI1OWI4OTg1NTM0NmU2Mjk4ZjM0YmU2NjJkOTAwM2JlZDYxZDBkNTEzZDc3ZTdmOTk0NGYwZDBjMWQzIn0=
and it always says {"message":"Unauthenticated."}
I'm running Laravel latest version, on Homestead on Windows.
I would really appreciate a little help, I have tried everything and nothing seems to be working. :(
Which Laravel Framework version are you using?
Which Laravel Framework version are you using?
Laravel Framework 5.7.28
Take a look at some solutions found here: #914
Take a look at some solutions found here: #914
Yes, I did look at it, but nothing there fix the problem. I was thinking of making a new project and test it, but I honestly the project that I work on, I just cloned it from my mate's github and set up homestead, nothing custom that might be the reason that it's on working.
If it's working for someone else and not for you then there seems to be something wrong with your setup. Unfortunately this isn't a support forum. Can you first please try one of the following support channels? If you can actually identify this as a bug, feel free to report back.
Hi. I've made a repository where I was able to reproduce the issue.
https://github.com/esron/passport_with_laravel_6
I've initiated a project Laravel on version 6 and passport on version 8.
Following the docs, I've also installed the auth UI scaffolding. Even when I am logged in I get 401 Unauthorized when I try to get the /api/user route.
Here is my route definition:
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Updating Passport to version 9.x solved the issue.
Most helpful comment
Hi. I've made a repository where I was able to reproduce the issue.
https://github.com/esron/passport_with_laravel_6
I've initiated a project Laravel on version 6 and passport on version 8.
Following the docs, I've also installed the auth UI scaffolding. Even when I am logged in I get 401 Unauthorized when I try to get the
/api/userroute.Here is my route definition:
Updating Passport to version 9.x solved the issue.