spring-guides / tut-spring-security-and-angular-js

Spring Security and Angular:: A tutorial on how to use Spring Security with a single page application with various backend architectures, ranging from a simple single server to an API gateway with OAuth2 authentication.

Home Page:https://spring.io/guides/tutorials/spring-security-and-angular-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error "A redirect is required to get the users approval"

tus1999 opened this issue · comments

Trying to create spring boot tutorial to mix social auth and spring authentication (user can signin using any of these methods)
Code is at https://github.com/tus1999/springbootsocialauth
But getting error "A redirect is required to get the users approval" when clicking on signin with facebook link. Regular Spring auth (username & pass) works fine. But facebook auth has this issue.

It looks like you copied some of the code from the other tutorial https://github.com/spring-guides/tut-spring-boot-oauth2/ without really understanding what it does. If you have @EnableOAuth2Sso then you don't need an OAuth2ClientContextFilter, but you do need to configure your OAuth2 client (e.g. like this one: https://github.com/spring-guides/tut-spring-boot-oauth2/blob/master/simple/src/main/resources/application.yml).

Hi Dave,
Thanks for a quick reply. Yes I think I am getting confused while mixing spring security with OAuth2. Is there a tutorial which has these working together. Use case is very simple. Would like have a login dialog box with 3 options
Option 1: Normal form with userid and password which will go to spring security authentication route
Option 2: Facebook auth
Option 3: Google auth
Thanks in advance

I don't know of such a sample precisely, but you could take something from https://github.com/spring-guides/tut-spring-boot-oauth2/ and add form login just by adding another link to the home page (e.g. by copying it from this tutorial).