Laravel, vue and axios login


I got everything down to make a login using laravel, vue and axios.

The only issue at the moment i have is with axios, i don’t know if i am at the right place, if i’m not, i’m sorry. Anyway

Everytime when i ‘login’ axios returns me these errors:


Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set ‘always_populate_raw_post_data’ to ‘-1’ in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0


The token is what i need, but i cant get to it… because of the warning

This is the post code im using to get this result

export default {
        email: "",
        password: ""
      var token = document.head.querySelector('meta[name="csrf-token"]');
      window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;'/login', this.loginDet)
          .then((res) => {
            let token =;
            localStorage.setItem('token', token);
          .catch((err) => console.error(err));

Am i missing headers? …
I hope that someone can help me here, because its pretty much bugging me for 2 days

Thank you so much!

I take it you’ve been through all of Laravel’s API Authentication docs?

We also use Laravel with our project, however the login is done on a dedicated page which then redirects to our app, so I merely need to pickup the token and pass it with each API request. API auth is a different story from what I can see.

Have you tried posting on the Laravel forum? As this is a PHP / Laravel auth issue it may be a better resource.

1 Like

Thanks for the quick response!

Infact i did not, and i am using JWTAuth if that helps,

And i can’t post anything on the Laravel forum because it looks like they want me to pay (Laracasts that is)

Hi, try this working link:
vue laravel auth login

This will help you :slightly_smiling_face: