Announcement Announcement Module
No announcement yet.
Spring Social Google SignIn Problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Social Google SignIn Problem

    When attempting to signin I receive the following error from Google:

    OAuth 2.0 error: redirect_uri_mismatch

    The redirect URI in the request: http: //localhost:8080/signin/google;jsessionid=1pcqvelta3gbk did not match a registered redirect URI

    However http://localhost:8080/signin/google is listed as one of the Redirect URIs for the application, so it appears the jsession parameter
    is throwing things off.

    The format of the full URL is of the form:

    https: // ttp://localhost:8080/signin/google;jsessionid%3D1pcqvelta3gbk&providerId=googl e& m&hl=en-US&from_login=1&as=333333333333333

    And interestingly when I remove the jsession suffix from the URL and resubmit the authentication does go through and I get redirected back to localhost. (Although I do have to reauthorize the app as being allowed even though I have previously granted its permission)

    I'm wondering if anyone else has come across this problem. My environment for this is the Google App Engine local server, but signin to Facebook does work in this environment. Other configuration settings that may be relevant are that I am also using Spring Security, but have the /signin/** and /signup/** paths set to “permitAll”. Additionally I am not using the Apache HttpClient (not on classpath) which I believe means that connectivity is handled by org.springframework.http.client.SimpleClientHttpRe questFactory.

    I would appreciate any suggestions on how to get this working or to further diagnose the problem.

    Thank you,

  • #2
    I had this problem and the reason was that the redirect API I used in my app didn't match the redirect API I specified in my Google API console


    • #3
      Thank you for the response. Could you please elaborate further? I believe these values agree in my project.

      In my jsp I have:

      <form name="ggl_signin" action="<c:url value="/signin/google"/>" method="POST">
      <input type="hidden" name="scope" value="" />
      <button type="submit">Sign in with Google</button>

      which generates the redirect URL I listed originally http://localhost:8080/signin/google;...=1pcqvelta3gbk

      In my Google APIs Console, one of the Redirect URIs is:



      • #4
        try to search for my name on this forum. I don't exactly remember how I solved it but I did post that. If the urls are in fact the same, one thing that might be a problem is the fact that you use localhost. Try specifying a hosts file "real-fake" url, e.g., that points to your localhost and use that. Perhaps Google requires a "real" url.


        • #5
          As best I can tell from your earlier thread the problem you referenced was around using "/connect/google" rather than "/signin/google". I can reproduce the problem on my production server, so the problem is not related to using localhost.

          Is anyone using this with HttpSessions where the jsession is being appended to the URL? I believe this is the cause, so it would be helpful to know what others are experiencing.

          Perhaps the Spring Social Google implementation should be ignoring request parameters when building URLs to communicate with Google?