Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
How to load authorized user's data in vuejs in the right way

I'm trying to build an app based on a couple with Laravel and Vuejs.

I've implemented a method in Vue that sends POST login and gets an accessToken from back's Laravel. My next challenge is to get an authorized user's data to show in NavBar and so on. What is the right way to do it?

Way 1: The login method on the app's back returns not only the accessToken. He also puts a user's data into the response. So, after the login request, Vue gets the accessToken and user's data that I put into localStorage inside of Vuex.

Way 2: The login method returns only the accessToken. After getting accessToken, Vue makes one more request to get a profile of the authorized user by the accessToken.

What's the correct way to get an authorized user's profile?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Both approaches are correct, but I think there is no need to get the profile with the login response .

I will only return the accessToken and store it somewhere safe, and when you need the user profile you make another request.

and for showing different types of NavBars,you can use an event emitter to trigger different actions (login, logout)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!