Angular 9 SPA + Spring Boot resource Server

Hi Everyone,

SPA Angular 9 created using the quick start.
Spring Boot Resource Server (also using quick start).

SPA has been modified to add an interceptor to the http requests and get token from the modified auth service (added a get token method).

Token sent to the Spring Boot resource server is invalid (and doesn’t seem to validate in JWT.io) and gives a 401.

My understanding is that the flow I’ve implemented is implicit flow, and that once the client (SPA) has authenticated I can simply get the token (calling geTokenSilently()) and pass it onto the server?

Or am I missing something?

thanks in advance…

Ok, spotted it today.

When I call getTokenSilently() in the Angular Authentication services, I hadn’t specified the “audience” parameter for my API.

All sorted now!

1 Like

Wohoooo! Glad you have figured it out and thanks a ton for sharing it with the rest of community!

1 Like