'axios reactjs passing authtoken headers saying invalid token

I am having issues passing my authToken as a header from local storage. Its saying invalidToken but when i console log it and paste and pass it statically its working.

const submitHandler = async (e) => {
    e.preventDefault();
    const token = localStorage.getItem("authToken");
    console.log(token);
    axios.post("http://localhost:5000/api/user/transfer",
        {
          phonenumber,
          amount,
        },
        {
          headers: { "Content-Type": "application/json", "authToken":  {token} },
        }
      )
      .then(function (response) {
        console.log(response);
        navigate("/dashboard")
      })
      .catch(function (error) {
        console.log(error.response.data.message);
        setError(error.response.data.message)
      });
  };


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source