• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

265
Views
Why is my request working in postman but not axios?

I am trying to make a request in axios. The same request works in postman.

await axios({
      method: "post",
      url: `https://ecommersappbytim.herokuapp.com/info/${userId}/update-user`,
      header: {
        "Content-Type": "application/json",
        "auth-token": { token },
      },
      data: {
        firstName: userInfo.fName,
        lastName: userInfo.lName,
        email: userInfo.email,
        password: userInfo.password,
      },
    })

Is there something I am missing? I have made sure that I am passing in the correct data.

almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I have found the same error, apparently it is a CORS problem with the headers. What worked for me was passing the token through the url in the form of a query and receiving it in the backend through passport with its jwtFromRequest: ExtractJWT.fromUrlQueryParameter('auth-token'). I don't know if it is the most optimal way to pass the token to the backend but it is the one that worked for me.

I hope this has helped you.

over 2 years ago · Nicolás Marsili Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error