Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

amoktar's avatar

how to protect axios api requests, with basic laravel authentication?

Hello Laravel community I'm trying to accomplish this cenareo

  • Laravel 7

with in laravel view.blade, I want to make axios requests to api to be authenticated , all with the laravel basic authentication

So I was wondering what the best solution

  • is it to use jwt and store it on (session or local storage) ? so user login with the laravel out-of-the-box auth, get auth token, store auth token, send it with axios config

the qustion : is this whole solution is ok?

0 likes
4 replies
bugsysha's avatar

What do you consider as "Laravel basic authentication"? Cause JWT is not basic auth for Laravel.

amoktar's avatar

@bugsysha how is it going?

I ment the traditional login forms with laravel auth

Please or to participate in this conversation.