'Why am I getting an "invalid_request" error?

Currently I am making a "POST"request to get an "Oauth token". I wrote the following according to the guide.

let postData = qs.stringify({
  grant_type: `authorization_code`,
  code: "..//",
  redirect_uri: "...//",
  client_id: "...//",
  client_secret: "...//",
});
const options = {
  hostname: "api.line.me",
  path: "/oauth2/v2.1/token",
  method: "POST",
  Headers: {
    "Content-Type": "application/x-www-form-urlencoded",
    "Content-Length": postData.length,
  },
};

But,

I get a response like below.

{"error":"invalid_request","error_description":"Parameter conditions \"grant_type=refresh_token\" OR \"grant_type=authorization_code\" OR \"grant_type=client_credentials\" not met for actual request parameters: "}

I usually wrote "grant_type" as "string" type,

I don't know what the problem is.

Please help Me.



Sources

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

Source: Stack Overflow

Solution Source