Question

I am completely stumped by this. I have the following Facebook App Access Token registered for my app:

|

And then I try to GET the following URL: (Fake token underneath)

 https://graph.facebook.com/<user-id>/likes?access_token=<number>|<hash>
 String accessToken = "258443224256787|dsK3fffe7g-rejponkVlfwef3GenVng6Y";

 WS.url("https://graph.facebook.com/" + socialUser.id.id + "/likes?access_token="+accessToken)

 accessToken = "258443224256787" + URLEncoder.encode("|") + "dsK3ks7g-dsK3fffe7g-rejponkVlfwef3GenVng6Y";

I get the following error message:

{"error":{"message":"An access token is required to request this 
resource.","type":"OAuthException","code":104}}

When I use it in the Graph API explorer tool however, I get no errors! I think the problem might be that I don't know how to use the pipe symbol in my URLs (tried Googling for hours without success - attempted URLEncoder.encodre to no avail).

Help please! :-)

(I'm using Java Play! 2)

Edit I should say that when I debug my link I get: "%7C" instead of pipe, due to the URLEncoder.

Edit 2 It also works when I post the URL directly into the browser.

Edit 3 Added URLEncoder-code

Was it helpful?

Solution

Turns out that WS.url() didn't accept my query parameters unless I used url().setQueryParameters() which solved the problem. :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top