Guys, I solved it myself.

The problem was in the "code" parameter, that must be encoded before
fetching the URI.
so the right code is:
String redirUrl = "https://graph.facebook.com/oauth/access_token?
client_id=" + fbAPIKey +
                                "&redirect_uri=" + 
AppParams.getParam("serverAddr") +
"landingFacebook" +
                                "&type=client_cred&client_secret=" + 
fbAPISecret +
                                "&code=" + URLEncoder.encode(code, "UTF-8");

Bye CRI

On Aug 18, 12:07 pm, cghersi <cristiano.ghe...@gmail.com> wrote:
> Hi,
>
> I'm trying to connect to Facebook API, and to get the access token.
>
> I'm able to retrieve the "code" parameter following the instructions
> in:http://developers.facebook.com/docs/authentication/
> but when I want to exchange this code with the access token, I find a
> strange behaviour: in my deployed google app, everything works fine,
> on localhost (debugging it) I get the following exception:
> Invalid uri 'https://graph.facebook.com/oauth/access_token?
> client_id=44d82e8afe7db2555ee00000b767522&redirect_uri=http://
> localhost:8888/
> landingFacebook&type=client_cred&client_secret=b20000650a00fa00eead379da7a0 
> 595d&code=2d6357c0000c205ffcf187a3-1000341834|
> K5-itbx2pirplfxTNCoP-z_hgmw.': Invalid query
>
> What's wrong with this uri?
> It is exactly the same used in the previous 
> call:https://graph.facebook.com/oauth/authorize?client_id=xxx&redirect_uri...
>
> Am I missing anything?
> Is there a simpler way to get this access token, perhaps via facebook-
> java-api-3.0.2 library?
>
> Thank you!!
>
> Bye CRI

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to