I am currently struggling to obtain the access token through the Docusign API. My code is producing an error in Xcode and I am unable to make it work on my native device or browser, despite successfully testing it via Postman. When attempting to run it in a browser, I encounter a CORS error, which was expected. However, I cannot understand why it fails on an iPhone.
My project utilizes Ionic and TypeScript. Most of the examples I have come across involve Express with extensive amounts of code that I find challenging to integrate into my Ionic project. If resolving this issue requires more than minor adjustments, I am open to hiring someone to assist me in getting it up and running.
Thank you
// Obtaining Docusign access token using authorization code
const post_data = {
'code': this.dsAuthCode,
'grant_type': "authorization_code"
}
// HTTP Options
const httpOptions = {
headers: new HttpHeaders({
'Authorization': "Basic " + b64ds
})
}
this.httpClient.post('https://account-d.docusign.com/oauth/token', post_data, httpOptions)
.subscribe((data:any) => {
this.dsAccessToken = data.access_token
console.log('Access Token ', data.access_token)
//this.docsignUserURI(data.access_token)
}, error => {
console.log('access token error', JSON.stringify(error));
});
access token error {"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":"https://account-d.docusign.com/oauth/token","ok":false,"name":"HttpErrorResponse","message":"Http failure response for https://account-d.docusign.com/oauth/token: 0 Unknown Error","error":{"isTrusted":true}}