Question

I am trying to set up Omniauth as described in this Railscast. While it works with Twitter, I am unable to get it working with Facebook. I also set up 'http://localhost:3000' as siteurl and 'localhost' as domain but still see the following error message in the browser:

Invalid redirect_uri: Given URL is not allowed by the Application configuration.

Does anyone of you have any suggestions on how to fix this? Thanks in advance.

Was it helpful?

Solution

Take a look at the redirect in the URI. Mine read localhost:3000 so I changed the Site URL to "http://localhost:3000/" and it worked.

OTHER TIPS

Here's what worked for me.

Right now Facebook does not allow setting the Site Domain to an IP, so it's not possible to set the Site URL to http://127.0.0.1:3000/ because then Facebook will complain that the URL does not match the domain.

So in your Facebook App set the:

Site URL: http://localhost:3000/
Domain: localhost

When you access the app on your dev machine make sure you type in localhost:3000 in the browser. If you use 127.0.0.1:3000 OmniAuth will use that in the callback url it sends to Facebook and then Facebook will throw the error Ryan mentions above.

I switch to http://lvh.me:3000 in my local browser to test facebook locally. Then in facebook app settings, make lvh.me your domain.

lvh.me is a registered domain pointing to 127.0.0.1 that a developer bought to test subdomains locally.

Try using

http://0.0.0.0:3000/

for the 'Site URL'. This works for me. (Also, I don't have anything in the 'Site Domain' field.)

If you are on OSX you can use pow http://pow.cx/ to rename localhost to

http://yourapp-dev  

(is not really renamed, it's added)

you can set that as a valid domain name on facebook.

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