laravel / jetstream

Tailwind scaffolding for the Laravel framework.
https://jetstream.laravel.com
MIT License
3.98k stars 822 forks source link

GET route on /api/user not accessible #386

Closed marijnbent closed 4 years ago

marijnbent commented 4 years ago

Description:

The default /api/user route is not accessible. When logged out, the login page is shown. When logged in, you get redirected to the dashboard. When accessed using Insomnia with an Authorization header and valid API key present I get a "message": "Unauthenticated.".

Steps To Reproduce:

  1. Register and create an account
  2. Go to /api/user
  3. You get redirected to /dashboard
bonzai commented 4 years ago

I can't confirm using the latest version of Jetstream (1.5.1) and Laravel (8.11.2):

axios.get('/api/user').then(response => {
    console.log(response.data) // {"id":1,"name":"Test User"...}
})

It also works in Insomania using the Authorization header:

> GET /api/user HTTP/1.1
> User-Agent: insomnia/2020.3.3
> Authorization: Bearer MY_API_TOKEN
> […]

{"id":1,"name":"Test User"...}

Make sure you have added your domain to stateful option in the config/sanctum.php file.

driesvints commented 4 years ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.