我正在使用FuelSDK-node-REST通过以下此处给出的说明进行API请求:https://github.com/salesforce-marketingcloud/FuelSDK-Node-REST。运行我的代码后,出现错误。下面是我的代码和收到的错误。
const FuelRest = require("fuel-rest");
const options = {
auth: {
clientId: "CLIENT_ID_HERE",
clientSecret: "CLIENT_SECRET_HERE",
authUrl:
"https://MY_AUTH_URL.auth.marketingcloudapis.com/v2/token/", //Tried without '/v2/token/' also
},
origin: "https://MY_ORIGIN.rest.marketingcloudapis.com/",
};
const RestClient = new FuelRest(options);
const getOpts = {
uri: "/platform/v1/endpoints",
headers: {},
// other request options
};
RestClient.get(getOpts)
.then(function (response) {
var result = response && response.body ? response.body : response;
console.log(result);
})
.catch(function (err) {
console.log(err);
});
运行代码时出现此错误:
{ Error: No access token
at AuthClient.getAccessToken.then.tokenInfo (E:\Development\node-scripts\node_modules\fuel-rest\lib\fuel-rest.js:88:18)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
res:
{ error: 'unsupported_grant_type',
error_description: 'Use "authorization_code" or "refresh_token" or "client_credentials" or "urn:ietf:params:oauth:grant-type:jwt-bearer" as the grant_type.',
error_uri: 'https://developer.salesforce.com/docs' } }
我的帐户中看不到已安装应用程序的权限等任何问题。任何帮助将不胜感激!