I encountered a CORS error when attempting to call the token/authorize API in Angular, even after adding it to the trusted origin. However, the login functionality is working properly

This is an old devforurn CORS blocked Access-Control-Allow-Origin ,
it seems similar to this issue though

Hi Sherry,
Login okta is working fine for me but when i try to access token/authorize API’s am getting CORS error

Are you doing a redirect or AJAX calls to the /authorize?

Okta - the /authorize endoint blocked by CORS CORS error on Okta authorize api end point from frontend - #3 by rahul.garg

Am using httpclient post call in angular 13 applicayion

Can you provide the code config?

refreshAccesstoken(): Observable {
let url = ‘https://{{myOctaURL}}/oauth2/default/v1/token’;
let headerOptions =
{
headers: new HttpHeaders( {
‘accept’:‘application/json’,
‘cache-control’:‘no-cache’,
‘content-type’:‘application/x-www-form-urlencoded’ })
};
return this.http.post(url, {
‘grant_type’:‘refresh_token’,
‘redirect_uri’: myAppConfig.oidc.redirectUri,
‘refresh_token’: this.dataSharignService.getRefreshToken(),
‘scope’: ‘offline_access%20openid’
}, headerOptions)
.pipe(
catchError((err) => this.handleError(err))
);
}