Hi
I am new to power app custom connectors - could you help with this ?
The call is successfully with javascript below but I don't know what settings I need to do for custom connectors (I did some tests with a public API and this is working just I don't know for this one below what I need to set)
async function fetchWebApi()
{
var details = {
'userName': ‘username’,
'password': 'password',
'grant_type': 'password'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);
formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
let response = await fetch('http://XXXX/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: formBody
})
let commit = await response.json();
console.log(commit);
console.log("Status " + response.status);
alert("Status " + response.status);
if (commit != null)
{
console.log(commit.access_token);
getAllClients(commit.access_token);
}
}
async function getAllClients(acessToken) {
let response = await fetch('http://XXX:80/method', {
headers: new Headers({
'Authorization': 'Bearer ' + acessToken,
'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8'
}),
method: 'GET'
})
let result = await response.json();
console.log(response);
console.log(result);