Announcement Announcement Module
Collapse
No announcement yet.
request_uri encoding issue with facebook example? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

    Code:
    <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>
    	</form>

    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:


    https://graph.facebook.com/oauth/aut...onse_type=code


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

    https://graph.facebook.com/oauth/aut...onse_type=code


    Probably something stupid on my part. Any ideas?

  • #2
    Notice the definition of application.url property in spring social showcase:
    https://github.com/SpringSource/spri...properties.xml

    Now see it injected into ConnectController:
    https://github.com/SpringSource/spri...ontrollers.xml

    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.

    Keith

    Comment


    • #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">http://127.0.0.1:8080/quantbenchWeb</prop>

      and am injecting that in:

      <bean id="connectController" class="org.springframework.social.connect.web.Conn ectController">
      <constructor-arg value="${application.url}" />
      </bean>

      I am using Spring 3.0.5, should I use 3.1?

      Comment


      • #4
        Does http://127.0.0.1:8080/quantbenchWeb 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.

        Comment


        • #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 "https://graph.facebook.com/oauth/authorize?client_id=0b754d95f9c9899b0d6c4454b6f2dd 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.

          Comment


          • #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:

            http://127.0.0.1:8080/quantbenchWeb/

            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 org.springframework.social.connect.jdbc.JdbcUsersC 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,

            Joe

            Comment


            • #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:

              http://forum.springsource.org/archiv...t-109348.html?

              Let me know if I can help with a repro.

              Joe

              Comment

              Working...
              X