Closed akurudi closed 4 years ago
If someone else stumbles across this, I was missing authOptions
in the rest client initialization. Below is the correct way to init the rest client.
const options = {
auth: {
clientId: "CLIENT_ID_HERE",
clientSecret: "CLIENT_SECRET_HERE",
authUrl:
"https://MY_AUTH_URL.auth.marketingcloudapis.com/v2/token/",
authOptions: {
authVersion: 2,
}
},
origin: "https://MY_ORIGIN.rest.marketingcloudapis.com/",
};
const RestClient = new FuelRest(options);
I'm trying to make a simple GET request using OAuth 2.0 and grant_type: 'client_credentials' but i keep getting an error. I followed the readme doc to initialize and make a request like below.
Error i am getting is
Please let me know if i did something wrong with the initialization or misunderstood the docs.