I am trying to call API /v1/revoke from an Angular 6 client with OKTA implicit flow (using library angular-oauth2-oidc). From the sample program, I add a new function revokeToken() as the library doesn't implement a revoke-token function. I include "http://localhost:8080" as a trusted origin but still get the following error:
Access to XMLHttpRequest at 'https://mydevid.oktapreview.com/oauth2/default/v1/revoke' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here is the setup from OKTA
Here is my function in an Angular component
revokeToken() {
const httpOptions = {
headers: new HttpHeaders()
.set('accept', 'application/json')
.set('authorization', 'Basic ' + authConfig2.clientId)
.set('content-type', 'application/json')
};
const body = {
'token': this.access_token,
'token_type_hint': 'access_token'
};
this.http.post(authConfig2.issuer + '/v1/revoke', body, httpOptions)
.subscribe(console.log);
}
Could someone advise what I have done wrong or not setup properly?
Thanks.