Home > Enterprise >  Use spring spring-boot-starter-oauth2-client with angular
Use spring spring-boot-starter-oauth2-client with angular

Time:09-11

I want to make an application with the ability for the user to connect with google.

I've used spring-boot-starter-oauth2-client and when I access my api directly with my browser i'm correctly redirect to google and i can connect with google.

But when i acces my api with my angular application, i'm not redirected and I get has a response an html document with a link to google.

I think I miss the step to how to connect angular and spring.

Do anyone have tried to do the same configuration ? Should i handle oauth flow only in angular ?

CodePudding user response:

Your "API" is a resource-server, not a client.

See this article for basic OAuth2 notions and spring secured resource-server configuration.

Also, you should use an OAuth2 client lib for Angular. My favorite is angular-auth-oidc-client.

  • Related