Hello, @mcardosob !
I believe what you are looking for is Laravel Passport. Check the following link: https://laravel.com/docs/5.8/passport#consuming-your-api-with-javascript
Let me know if it helps.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am building a laravel API that be consumed by my frontend (javascript).
Until now, I login my user and send a token in body response. And I consume the token with my frontend.
In my frontend app, I need to download an audio resource with the audio tag (html). To load my audio, I need to be authenticated, but I can't send auth headers with the audio tag. So the only solution is to authenticate my app with cookie token.
Can I use authenticate my user with cookies in my api routes ?
Please or to participate in this conversation.