-
Notifications
You must be signed in to change notification settings - Fork 41.2k
@EnableOAuth2Sso breaks Google App Engine #10553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@alexmitic It's not clear from the logs why there is a failure when processing a |
@mbhave I simply followed this example application that google has for spring-boot and App Engine Standard environment. I've added OAuth 2 by adding
to my dependencies and This is the minimal example pom.xml
ServletInitializer.java
SpringBootExampleApplication.java
appengine-web.xml
application.yml
I am able to deploy this but when I try to access the page I get the same error as before. This is really weird because everything else works just as expected when deployed. Its just the OAuth2 that works locally but not when deployed. |
I was able to reproduce this on Google App Engine. My guess is the underlying exception for the |
@mbhave Is it possible to get the stack trace when this is logged:
I, like you, don't know why this only occurs on GAE. It might help us to figure it out if we knew a bit more about when things are starting to go wrong. |
@mbhave @wilkinsona Is there some temporary fix I can implement that will enable this functionality? |
After investigating this a bit further, we've found that the underlying error occurs because Spring Framework decides to use @alexmitic a possible workaround that I can think of for now is to add |
@alexmitic I managed to get OAuth2 working with Spring Boot & GAE standard but I'm not using the SSO annotation directly - I'm using @EnableOAuth2Client and manually constructed Filter, as described in one of the phases of boot tutorial ( https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_manual ). Just to be clear though, I was not attempting to use sso annotation (for non-GAE related reasons) so I'm not sure if that would work if I tried, or would I face same issue as yourself. Try decomposing the SSO as described and that should work. If it still doesn't, you might have a different problem. One other thing to note is that there is some weird problem happening related to GAE not storing the session data correctly (happening on real GAE only, not when run locally). I've had to implement my own SessionRepository, as described here: https://stackoverflow.com/questions/45217234/issue-with-using-spring-oauth-on-java8-standard-environment |
@lilianaziolek I saw on that stackoverflow-question you posted that you had converted the SessionRepository Kotilin code to Java and made it work. Would you mind sharing that piece of code? I'm having some trouble with it as I'm quite new to spring and GAE. |
@alexmitic I don't have time right now to prepare a full package of the whole oauth config, but just for the memcache session repo stuff I've put the code involved in this gist: https://gist.github.com/lilianaziolek/6851c2f81be81eae2207ec863f41f484 |
@lilianaziolek That was enough! I managed to get it to work. Thank you very much! |
The underlying issue has been fixed in Spring Framework so this should work as expected now. |
Summary
I have added OAuth2 support to my application by following this tutorial https://spring.io/guides/tutorials/spring-boot-oauth2/, that uses
spring-boot-starter-security
andspring-security-oauth2
. With the help of the@EnableOAuth2Sso
annotation I get the app to authenticate with gmail. When I run this app locally it works without any problems but when I deploy to Google App Engine I getServer Error 500
. If I remove the authentication the app works when deployed. I've tried authenticating both with Facebook and Google, both give a server error when deployed. I initially posted this issue to spring-security but was told this was most likely related to Boot and told to post here.Actual Behavior
On the server I get the following stack trace
Expected Behavior
When a user reaches a part of the domain, they should be guided to a google sign-in form. This happens locally but not when deployed to server.
Configuration
In my application properties I have
And I configure the authentication
Version
spring-boot 1.5.6.RELEASE
spring-boot-starter-security 1.5.6.RELEASE
spring-security-oauth2 2.1.1.RELEASE
appengine-api-1.0-sdk 1.9.54
Here is my whole pom.xml if it adds some clarity
The text was updated successfully, but these errors were encountered: