Announcement Announcement Module
No announcement yet.
request_uri encoding issue with facebook example? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • request_uri encoding issue with facebook example?

    Hi Guys,

    I am working on getting a facebook connection going pretty much following the spring-social-showcase. When i attempt the Post:

    <form id="fb_signin" action="<c:url value="/signin/facebook"/>" method="POST">
    		<button type="submit"><img src="${pageContext.request.contextPath}/images/facebook-connect.png"/></button>

    I get an Oauth error response from facebook:

    "error": {
    "type": "OAuthException",
    "message": "redirect_uri isn't an absolute URI. Check RFC 3986."

    The url in the browser looks to be encoded:

    When I un-encode the URL, I am brought to the facebook login page:

    Probably something stupid on my part. Any ideas?

  • #2
    Notice the definition of application.url property in spring social showcase:

    Now see it injected into ConnectController:

    See JavaDocs for ConnectController for more info. The application.url is expected to be the absolute base URL for your app and is used to generate the redirect URI.



    • #3
      Hi Keith,

      Thanks for getting back to me so quickly. Yup, I followed the property in spring social showcase, and am using:

      <prop key="application.url"></prop>

      and am injecting that in:

      <bean id="connectController" class=" ectController">
      <constructor-arg value="${application.url}" />

      I am using Spring 3.0.5, should I use 3.1?


      • #4
        Does also match the "Site Url" Facebook has on profile for your app?

        3.0.5 should work fine. You could try 3.1.0.M2 for kicks, but I don't see this being related.


        • #5
          I don't believe it's a Spring 3.0.5 problem (just tried the showcase in Spring 3.0.5 to be sure).

          The encoding is done on Facebook's side after the POST. Even with my working showcase sample, if I trace the POST request, the response comes back as HTTP 302 with the Location header set to " e7&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fsp ring-social-showcase%2Fconnect%2Ffacebook&response_type=code&s cope=publish_stream%2Coffline_access" (notice the encoding in the redirect URI).

          I'm wondering if this has less to do with how you've configured Spring Social in your app and more to do with how you've registered your app with Facebook. In your application's settings on Facebook, what is the Site URL set to? If it's a relative URL (or possibly if it's empty), then that may be your problem.
          Last edited by habuma; Jun 8th, 2011, 02:56 PM.


          • #6
            Hi Craig,

            Thanks for getting back to me.

            Yeah. It is weird. Using your sample as a blueprint(Thanks! It is great.). In the facebook app I am using as url:


            I have left the 'Site Domain' field empty.

            When I take the encoded url and unencode(in emacs), I am forwarded to the facebook login.

            Twitter is forwarding correctly, but I am guessing that is oauth1.

            Also, I should should mention that I am replacing onnectionRepository with a repository that uses SimpleDB(I am bound by Amazon Web Services here), but this seems like it would be something after the actual authentication.

            Thanks again for you time,



            • #7
              Hey guys,

              I upgraded to spring 3.1 and am using the SNAPSHOTs of spring-social(and -facebook sub project) and I was able to get the facebook login page. I wonder if this is somehow related to:


              Let me know if I can help with a repro.