13

When asking for authorisation by redirecting to the following url:

https://graph.facebook.com/oauth/authorize?client_id=...&scope=email,offline_access&redirect_uri=http%3A%2F%2Flocalhost%2Flogin%2Findex.php%3Fcallback%3Dfacebook

Facebook returns 'Invalid redirect_uri Given URL is not permitted by the application configuration.'

Possibly because my application is registered with http://syncacity.com on the application configuration. But still, twitter allows me to redirect to any url, so why is facebook whining?

I'd appreciate your thoughts :)

rob_mccann
  • 1,237
  • 2
  • 11
  • 16

6 Answers6

10

why not just edit your hosts file and point your domain to your local ip then you only need to switch the dev box hosts before doing anything.

  • I asked this question years ago and just thought I'd come back and let you guys know that this is what I've been doing since. I add the live, production domain to my hosts file and switch it back after. It also helps when testing within Facebook Tabs. Just remember to change it back when testing deployments :) – rob_mccann Jun 05 '13 at 21:50
9

Change your application url to http://localhost while you develop and then to your site once it's in production. :)

Blake
  • 131
  • 2
  • 18
    This is a poor solution. Facebook is restricting the redirect url to a setting in your fbApp. That makes it damn hard to develop with a live website. Why is their 'site' not a list of approved servers so you can add machines one-by one for testing? Internal IPs + external web site. – Kieveli Apr 19 '11 at 17:58
  • 4
    @Kievli : One solution is to create an application for each environment and keep the keys in a config file. That's the easiest way I found to work with FB logins. – mrmuggles Nov 08 '11 at 14:48
  • Using localhost didn't work for me. I even added all the IP addresses to whitelist, but it still won't let me use something that resolves to a private IP in `redirect_uri`. – f.ardelian Apr 05 '12 at 09:47
4

it got resolved - thanks to one of the Facebook platform developers.

Let's say your local site URL is http://localhost:8000 You will need to add http://localhost:8000 to the Facebook App setting at "Settings -> Basic -> Website->Site URL."

anh_ng8
  • 1,100
  • 10
  • 16
Bernard Banta
  • 755
  • 8
  • 14
2

Following worked for me:

App Domains: localhost
Site URL: http://localhost

enter image description here

lubosdz
  • 4,210
  • 2
  • 29
  • 43
1

I create a test app in sandbox mode (advanced settings) then integrate to that for development and test

Anthony Johnston
  • 9,405
  • 4
  • 46
  • 57
0

You have defined localhost url in redirect_url (redirect_uri=http://localhost/login/index.php ..) I'm not familiar with OAuth but that might be the problem.

Pekka
  • 34
  • 1