Auth0 Angular 1.4.1
NodeJS 16
Angular 11
The code codes can be found from my Github account, the codes are based on this auth0 blog.
Check my example from the following repo:
I am trying to use a proxy config to bypass the cors issue, it worked well in the past years.
The proxy config file is here.
When I tried to create a post, the browser raised a 401 error.
Status401
Unauthorized
VersionHTTP/1.1
Transferred1.40 KB (0 B size)
Referrer Policystrict-origin-when-cross-origin
In the backend API, the console printed the following logs.
2021-05-02 20:45:02.097 DEBUG 18068 --- [io-8080-exec-10] o.s.security.web.FilterChainProxy : Securing POST /posts
2021-05-02 20:45:02.097 DEBUG 18068 --- [io-8080-exec-10] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
2021-05-02 20:45:02.099 DEBUG 18068 --- [io-8080-exec-10] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext
2021-05-02 20:45:02.099 DEBUG 18068 --- [io-8080-exec-10] o.s.s.w.session.SessionManagementFilter : Request requested invalid session id b908a19252e9509245bebb463418
2021-05-02 20:45:02.100 DEBUG 18068 --- [io-8080-exec-10] o.s.s.w.a.i.FilterSecurityInterceptor : Failed to authorize filter invocation [POST /posts] with attributes [hasAuthority('SCOPE_write:posts')]
2021-05-02 20:45:02.100 DEBUG 18068 --- [io-8080-exec-10] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
Note: the backend API is tested by JUnit and Spring Boot test utilities.