John
John

Reputation: 1276

having trouble using facebook omniauth

i'm trying to authenticate with facebook i have a sinatra app working correctly with twitter.

app.rb

use OmniAuth::Builder do
provider :twitter, 'xxx', 'yyy'
provider :facebook, 'xxx', 'yyy', :redirect_uri => 'http://localhost:9393/auth/facebook'
end

i'm referencing the facebook link in my view like,

     %a{:href=>"/auth/twitter"} Sign In To Twitter
     %a{:href=>"/auth/facebook"} Sign In To Facebook

and i'm being returned

https://graph.facebook.com/oauth/authorize?response_type=code&client_id=268504329935589&redirect_uri=http%3A%2F%2F0.0.0.0%3A9393%2Fauth%2Ffacebook%2Fcallback&state=a88cbf5f83b2faeac173f23138440cddf48cd5faf0039fe6&scope=email

which looks like

{
"error": {
  "message": "Invalid redirect_uri: Given URL is not allowed by the Application      configuration.",
  "type": "OAuthException",
  "code": 191
   }
}

as far as I can tell, my settings look correct. many posts exist about this issue being tied to facebook and the apps registered url.

on facebook, this app is registered as

Site URL
http://localhost:9393/
Site Domain
http://localhost:9393/

Thanks.

Upvotes: 0

Views: 221

Answers (3)

John
John

Reputation: 1276

i actually found the answer,

App Domains: localhost/ and Website with Facebook Login: http://localhost:9393/?

the /? on the localhost (website w fb login) is the important detail

Upvotes: 1

brimil01
brimil01

Reputation: 705

I usually register a dev app in facebook and add the redirect_uri to my hosts file. Usually something like:

127.0.0.1 dev.mycoolapp.com

Upvotes: 0

Pritesh Jain
Pritesh Jain

Reputation: 9146

try App Domains: http://localhost/

its working for me in rails

Site URL:    http://localhost:3000/

App Domains: http://localhost/

Upvotes: 0

Related Questions