Carl
Carl

Reputation: 1276

Verification Error with omniauth-facebook in Rails

I have seen many posts about this type of error, but it doesn't seem that any that I can find apply to my case.

This is the error I am getting back from Facebook:

Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request

This is the website Site URL I have set up: http://landmark.dev/

This is the redirect URI I have defined: http://landmark.dev/auth/facebook/callback

this is my omniauth.rb (cleaned)

OmniAuth.config.full_host = "http://landmark.dev"

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, 'xxx', 'xxx'
  provider :facebook, 'xxx', 'xxx', :scope => 'email'
end

OmniAuth.config.on_failure do |env|
  [200, {}, [env['omniauth.error'].inspect]]
end

This is my routes.rb for the callback:

match 'auth/:provider/callback', to: 'sessions#create', via: :all

Twitter works great, by the way - it's just facebook that won't connect. I've been fighting with this for 3 days now and trying to find a solution. Thanks in advance for your help.

UPDATE: While waiting on an answer to this to help figure it out, I tried adding in omniauth-google-oauth2 as authentication through google+ is part of the plan for this project as well. It seems I get the same error from Google:

"error" : "redirect_uri_mismatch"

I would think this indicates some problem on my side, but I have no idea what it could be. The other odd thing is that Twitter still works just fine.

Upvotes: 2

Views: 336

Answers (2)

Bmxer
Bmxer

Reputation: 417

There is a bug introduced in the last update of omniauth-oauth2 gem. Dowgrande your gem version and it should work for while.

gem 'omniauth-oauth2', '~> 1.3.1'

You can see discussion here

https://github.com/intridea/omniauth-oauth2/issues/81

Upvotes: 2

CV-Gate
CV-Gate

Reputation: 1170

If you are trying this from your local machine (I guess you are doing so because I think that .dev domains are not available at this moment and you should be using a server like POW). The problem is that Facebook can't reach your machine.

You can use a solution like localtunnel http://localtunnel.me/ for development purposes or try to use localhost, I think localhost worked in the past although I'm not sure at this moment.

Upvotes: 0

Related Questions