Im developing a React Expo app where im trying to access a BC page i've created.
Im able to get access to the page in Postman, but i'm unable to get access in my Expo app.
Here is my code:
async function fetchToken(tenantId, clientId, clientSecret) {
let token;
try {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body:
"grant_type=client_credentials" +
"&client_id=" + clientId + "&client_secret=" + clientSecret,
});
if (!response.ok) {
throw new Error(`Failed to fetch token: ${response.statusText}`);
}
token = await response.json();
console.log(token);
} catch (error) {
console.error(error);
}
return token;
}
TLDR:
I get the wrong access token, can you help me get the correct one?