DEV Community

sm-a
sm-a

Posted on

1

eBay get access token with Axios don't work

When I execute the following code I get the following error message: grant type in request is not supported by the authorization server
What I am doing wrong?

const axios = require("axios");
axios.request({
url: "/identity/v1/oauth2/token",
method: "POST",
baseURL: "https://api.sandbox.ebay.com/",
auth: {
username: "", // eBay client id
password: "" // eBay client secret
},
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: {
"grant_type": "client_credentials",
"scope": "https://api.ebay.com/oauth/api_scope"
}
}).then(res => {
console.log(res);
}).catch(error => {
console.log(error)
})

Top comments (1)

Collapse
 
perkinsjr profile image
James Perkins

If I remember correctly content type is Content-Type: application/json
and not x-www-form-urlencoded.

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more