Why do you have index.php in the url? That should not be needed :)
Jul 29, 2022
9
Level 1
How to config sanctum laravel
Hello!
I'm trying to use Sanctum Laravel in my local server but I can't call my authenticated routes :(
My code is here:
- .env : https://github.com/icsbcn/test_sanctum/blob/master/.env
- api routes: https://github.com/icsbcn/test_sanctum/blob/master/routes/api.php
- config cors: https://github.com/icsbcn/test_sanctum/blob/master/config/cors.php
Register and Login no problem but when I try to call to authenticated route (http://www.test_sanctum.local/index.php/api/user) with the Bearer Token i see :
{ "message": "Unauthenticated." }
Could you help me?
Thank you so much!
Level 37
@icsbcn okay try running php artisan serve and in your postman make the same request but without the index.php it should work just fine
curl
--location --request GET 'http://www.test_sanctum.local/api/user'
--header 'Accept: application/json'
--header 'Authorization: Bearer 1|VhsBv0vjZa5EfbPqR61YSaEFqjjfg426SUK9ROry'
1 like
Please or to participate in this conversation.