1. John M.

    This is definitely a great post ! Its been really helpful especially for me, when I’m trying to learn about developing facebook app with gwt.

    I’ve glanced at your source code. On Util.java, you have
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;

    where do you get these libraries from ? Really appreciate if you could reply Thanks ! 🙂

    • slf4j is a logging facade for java which abstracts away the underlying logging implementation (log4j, logback). The famousity project uses maven for artifact management, and the slf4j dependency is expressed in the maven pom.xml. You can see it here. Maven retrieves this depedency from a maven repository, these are configured in the pom.xml as well. For a quick intro to maven see this link. Hope this helps.

  2. John M.

    Thanks erez !

    What about com.extjs.gxt.ui.client ? Is that from Maven repository too ? I’m currently working with Eclipse 3.6 and its pretty obvious that I’m an amateur in this field.

    I have found the eclipse plugin for Maven. Is that what I should be installing ? Or is there a work around solution without having to use Maven ?

    I hope I didn’t confuse you

  3. Pushkar

    Thanks for the great post Erez.

    The only concern – by keeping FacebookUtil under shared, you are probably exposing the secret API keys.

  4. Xall

    great post. But I have one question. I try to test my app in development mode, so I use the localhost:
    At the facebook app configuration site, I set the “Site URL” to “http://localhost:8888/” and the “Canvas URL” to “”. But when I visit the “Canvas Page” (http://apps.facebook.com/my_fb_app), There pops up always a dialog box with the message: “Plugin failed to connect to development mode server at[..]”

    • I’ve ran across the same problem, after reading this stackoverflow discussion I ended up removing everything after the port (e.g., use http://localhost:8888/ for both the “Site URL” under facebook settings AND the “returnUrl” query-string parameter I use for facebook requests. I think this means that you cannot debug GWT client code within eclipse (the debugger doesn’t halt on breakpoints), if you really need to debug the client-side code I suggest you use the original query string (with the gwt.codesvr parameter) but make sure you also use it for the “returnUrl” query string parameter and encode it correctly.

      • Xall

        Hey, thanks for the answer and for the stackoverflow link. The modification in the hosted.html works for me. But its also important to start a new debug session after the modification and as you described in your post to encode the redirection URL:
        Client side:
        Server side:
        java.net.URLEncoder.encode(urlString, “UTF-8”)

        I have still one question: Could it be that the app secret can be accessed from the client side? FacebookUtil.java is a shared class, so someone could call the getSecret() method from the client side with a hacked script or something else.
        I get the app informations from the server by a RPC and the appSecret is a transient field.

  5. pla

    I tried to import the project into Eclipse via Import-Maven-Existing Projects.
    But I didn’t figure out how to get it to work.
    It always gets me the error:
    package com.google.appengine.api.datastore does not exist

    Does anybody know how to import it into eclipse?
    Thx a lot

    • You need to install Google plugin for eclipse, you can grab it from here. This will install Google App Engine. Alternatively you can do that manually see the provided link it also explains how to do that.

  6. jots

    How to create the famousity application in eclipse plz tell us in detail…..? and wat the html file contains? and how to get only the email addresses of all the friends?

  7. pla

    Ok. thx you a lot!
    It worked quite well. I managed somehow to integrate it in my project. (with the same structure, Client, Server, Shared)

    But after the login in FB via a new Window, there appears “Module needs to be (re-) compiled”.
    Does anybody know, why this error could appear?

  8. muky

    I get an exception: {“error”:{“type”:”OAuthException”,”message”:”Error validating verification code.”}}
    in the fetchURL method.

    to resolve it we can change the type in the getAccessTokenUrl to type=”client_cred” but then we get an exception while trying to retrieve the friends list.

    it’s seems to me like there is no work around then to use the session
    and I’m not sure how to do it with an RPC call..

    Can some one help?

  9. Diego

    What about Util.fetchURL(url)?¿¿ I don’t know what is the method and its library. Besides, every time I’m going to validate the code I receive
    Error”: {
    “message”: “Error validating verification code.”,

    I just try to get an access_token. Thanks

    • fetchUrl can be found here for any real purpose I suggest you use a decent HTTP library such as the apache one. For your error you should double check your verification code and look a the Facebook tutorial to verify the instructions above are not outdated

Leave a Reply

Your email address will not be published. Required fields are marked *