AnsweredAssumed Answered

Tokens REST API with Angular 6 and Typescript

Question asked by PGiard@chacompanies.com on Aug 8, 2018

I am making token requests to the REST API on a Portal instance.  What I notice is that the code succeeds in Chrome and Firefox, but only works in Edge occasionaly.  Has anyone seen this behavior?  

 

 

private portalUrl = environment.portal_url;
private authUrl = '/sharing/rest/oauth2/authorize';
private tokenUrl = '/sharing/rest/oauth2/token';
private clientId = environment.client_id;
const headers = new HttpHeaders();
headers.append('Content-Type', 'application/X-www-form-urlencoded');

const oAuthData = new FormData();
oAuthData.append('client_id', oAuthParams.client_id);
oAuthData.append('grant_type', oAuthParams.grant_type);
oAuthData.append('redirect_uri', oAuthParams.redirect_uri);
oAuthData.append('code', oAuthParams.code);

return this.httpClient.post<T>(url, oAuthData, { headers: headers })
.pipe( catchError(this.handleError));

Outcomes