1
votes

There are many other question related to this, but they didn't help me fix my problem.

I'm using the Facebook server-side login for a website, which I want to test locally. The path that initiates the login action is [http://localhost:8080/fblogin] (this redirects to the Facebook login dialogue, and goes from there).

I can successfully get the code, but when I try to exchange that for an access token, I get the following error:

{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191}}

I am providing the redirect_uri, url encoded and it is the same as the one I use to get the first code. Here is the url I'm using to request the access token (with the all-caps query string parameters replaced with their actual values, of course):

https://graph.facebook.com/oauth/access_token?client_id=CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Ffblogin&client_secret=CLIENT_SECRET&code=CODE_FROM_FB

I suspect this might have to do with how my app is set up on Facebook. Here are the values I have set:

Display Name: (an actual display name here) 
App Domains: localhost 
Contact email: (an actual email here) 
Site URL: [http://localhost:8080/fblogin]

What do I need to tweak in the settings to get this to work? Or does this look correct?

By the way, if it makes any difference, I am using the Play! framework, version 2.0.1

2

2 Answers

0
votes

After digging around a little more, I found that it was necessary for me to use POST when sending the request from my server to get the access token.

0
votes

Interesting that using POST worked for you as this didn't for me.

In any case, did you add the query parameters using setQueryParameter()? (see How to make multiple http requests in play 2?)