Support Team, I have been trying to create a token credential with the Cypress request method. I was to produce the token within the Postman API library, however, when I try to reproduce the API with Cypress, I keep getting the 401 Error. Below is sample code I use to create the call.
const EMAIL_BASE = 'https://api-sandbox.dwolla.com/token';
const CLIENT_ID = 'client_id';
const SECRET = 'secret_key';
const BASIC_CREDENTIAL = `${CLIENT_ID}:${SECRET}`;
const CREDENTIAL_ENCODED = Buffer.from(BASIC_CREDENTIAL).toString('base64');
const formData = new URLSearchParams();
formData.append('grant_type', CREDENTIAL_ENCODED);
return cy.request({
method: 'POST',
url: EMAIL_BASE,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Basic ${CREDENTIAL_ENCODED}`,
},
body: formData
});
