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

716
Views
GET http://localhost:3000/api/auth/user/:id 401 (Unauthorized)

I'm using vue3 with axios and prisma, but I have a problem getting user info.

My postman request is ok (http://localhost:3000/api/auth/user/7), but my axios req is not.

Can you help me please ?

        async created () {
        const response = await axios.get('http://localhost:3000/api/auth/user/:id', { 
            headers: {
                Authorization: 'Bearer ' + localStorage.getItem('token')
            }
            
        });
        console.log('ici');

        
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Axios does not support URL parameters.

One solution would be to use template strings to build the request URL.

For example:

function getID(id) {
    const response = await axios.get(`http://localhost:3000/api/auth/user/${id}`,{ 
          headers: {
              Authorization: 'Bearer ' + localStorage.getItem('token')
          }  
    });
}

// getID(7);
about 4 years ago · Juan Pablo Isaza 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!