CORS problem with Angular and Spring

Okta, Spring Boot and Angular
Want to maintain okta authentication in spring boot and want to call API from angular. I have tried couple of options and none of them worked. Authentication flow is working fine when accessed API directly but not from angular. Domain added to trusted origins and enabled CORS as well.

How to solve this CORS error?

Access to XMLHttpRequest at '' (redirected from 'http://localhost:8069/cab/api/hello-world') from origin 'http://localhost:8069' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Network calls

Console errors

Just to confirm, is http://localhost:8069 in your trusted origins? The error message indicates it is not.

Yes, http://localhost:8069 is my trusted origin and added below code to allow cors
registry.addMapping("/**") .allowedOrigins("*") .allowedHeaders("*") .allowedMethods("*")

You cannot make an AJAX request to the authorize endpoint, you MUST redirect to this endpoint instead, as noted in our documentation

Thank you, do you have any blog or example for this scenario with jwt and custom authentication manager/provider?

What do you mean by “custom authentication manager/provider?” Are you trying to use a custom authorization server? Or are you trying to do something else?