更新时间:2022-05-03 07:05:44
来自axios
文档:By default, axios serializes JavaScript objects to JSON. To send data in the application/x-www-form-urlencoded format instead, you can use one of the following options.
对于Nodejs,您可以使用 querystring
模块,如下所示:
For Nodejs you can use the querystring
module as follows:
var querystring = require('querystring');
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
因此,您可以尝试data: querystring.stringify({ grant_type: 'client_credentials' })