Currently, I am using this approach to make a post request:
let body2 =`client_id=C123&grant_type=authorization_code&redirect_uri=http://redirecturl.com&code=abc-123`
let header = new HttpHeaders({
"Content-Type": "application/x-www-form-urlencoded",
"client_id": "C123"
})
let options = { headers: header }
this.http.post<any>(http://posturl.com, body2, options)
The response comes back as Invalid Client
Interestingly, when I replicate the same call using ajax, I receive the expected response
$.ajax({
url: 'http://posturl.com',
type: 'post',
data: {
"client_id": "C123",
"grant_type": "authorization_code",
"redirect_uri": "http://redirecturl.com",
"code": "abc-123"
},
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"client_id": "C123"
},
done: function (data) {
console.log(data);
}
At this point, I'm unsure what the underlying issue might be.