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

167
Views
Axios - Password Exposed in res.config

I am making an axios post request to my server to log a user in and logging the response in the console to observe the data being returned:

const Login = () => {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");

  const submitForm = (e) => {
    e.preventDefault();

    axios
      .post("http://127.0.0.1:3000/login", { email, password })
      .then((res) => console.log("res", res))
      .catch((err) => console.log("err", err));

    console.log({ email, password });
  };

I generate a token when the user successfully logs in, returning the user's data alongside this newly generated token. As you can see here, I am deleting the user password from the response body in order to not expose the password:

const generateToken = (user) => {
  delete user.password;

  const token = jwt.sign(user, config.appKey, { expiresIn: 86400 });

  return { ...user, ...{ token } };
};

Here is the logged data in the console. In image no.1, you can see there is no password in the data portion of the response.

enter image description here

However, in the config portion of the response, the password is exposed (see Image no.2). My question is, is this something to be concerned about? If so, how do I remove the user's password from the response altogether?

enter image description here

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If your connection is secure (HTTP over TLS, ...), it is not something you need to be concerned about.

The HTTP response does not include it, since the actual response payload is res.data.

It is stored in the axios response object, since res.config is the config that was provided to axios for the request. But it is not stored in any persistent storage.

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!