[Vuejs]-Acessing auth user attribute

0👍

If you are using it in web app then make sure you first check if user is already authenticated by using auth middleware or manually by using Auth::check() function.

Or

If you are trying to hit this by api that will not work here because session will not be maintained in that case. That’s why JWT tokens were introduced to maintain the state of an application.

0👍

I’ve solved it like this:

  $science = auth('api')->user()->science_id;

Thanks for the help!

Leave a comment