Reputation: 1262
I'm learning OAuth2 with spring boot. I've got a simple html file in my static folder,when I add spring-boot-starter-security
and spring-security-oauth2-autoconfigure
to maven dependency and request the html file from the browser spring boot redirects me to http://localhost:8080/login and shows a login form, But adding @EnableOAuth2Sso
annotation to application class results in error localhost redirected you too many times
How to solve this issue?
When I try to use facebook for authorization by adding following application.yml
security:
oauth2:
client:
clientId: 233668646673605
clientSecret: 33b17e044ee6a4fa383f46ec6e28ea1d
accessTokenUri: https://graph.facebook.com/oauth/access_token
userAuthorizationUri: https://www.facebook.com/dialog/oauth
tokenName: oauth_token
authenticationScheme: query
clientAuthenticationScheme: form
resource:
userInfoUri: https://graph.facebook.com/me
...
Instead of redirecting me to https://www.facebook.com/dialog/oauth spring boot still redirects me to http://localhost:8080/login & shows localhost redirected you too many times error What am I doing wrong? Why spring is not redirecting the request to https://www.facebook.com/dialog/oauth?
Upvotes: 1
Views: 1347
Reputation: 844
You have to generate your own clientId and clientSecret from Facebook apps dashboard https://developers.facebook.com/apps , I don't think those two parameters are still valid.
Also, if you want a good tutorial for Facebook Oauth2 authentication I recommend you this tutorial: https://www.callicoder.com/spring-boot-security-oauth2-social-login-part-1/
Upvotes: 1