Help me with patreon oauth (getting 400 and 401 error)

hii im creating a mern app, but im getting 400 error and sometimes 401 error after i approve patreon login from browser, this is my express js controller, kindly help me how to fix it?

const linkPatreon = async (req, res) => {
  const code = req.query.code;
  const params = {
    code,
    grant_type: "authorization_code",
    client_id: process.env.PATREON_CLIENT_ID,
    client_secret: process.env.PATREON_CLIENT_SECRET,
    redirect_uri: process.env.PATREON_REDIRECT_URI,
  };
  try {
    const tokenResponse = await axios.post(
      "https://www.patreon.com/api/oauth2/token",
      querystring.stringify(params)
    );
    const accessToken = tokenResponse.data.access_token;
    console.log(accessToken);
    const profileResponse = await axios.get(
      "https://www.patreon.com/api/oauth2/v2/identity?fields[user]=about,created,email,first_name,full_name,image_url,last_name,social_connections,thumb_url,url,vanity",
      {
        headers: {
          Authorization: `Bearer ${accessToken}`,
          "User-Agent": "sexyprompt",
        },
      }
    );

    return res.status(200).send({ accessToken: profileResponse.data });
  } catch (error) {
    return res
      .status(500)
      .send({ message: "Error linking account", error: error });
  }
};

Try to get the request uuid from the response headers so that this can be checked on our side.