Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
671 views
in Technique[技术] by (71.8m points)

ruby on rails - Omniauth: callback not firing, returns failure with "invalid credentials"

The facebook authentication in my Rails application, implemented with the Omniauth gem has stopped working recently.

The problem is that the controller action, that should be used by the callback is not getting fired, and the process immediately skips to failure with "invalid credentials" message.

log:

Started GET "/auth/facebook" for ::ffff:127.0.0.1 at 2017-03-29 11:12:29 +0200
Started GET "/auth/facebook/callback?code=<<code>>&state=<<state>" for ::ffff:127.0.0.1 at 2017-03-29 11:12:30 +0200
Started GET "/auth/failure?message=invalid_credentials&origin=<<origin>>&strategy=facebook" for ::ffff:127.0.0.1 at 2017-03-29 11:12:31 +0200
Started GET "/login" for ::ffff:127.0.0.1 at 2017-03-29 11:12:31 +0200
Processing by UserSessionsController#new as HTML

routes:

  match "/auth/failure" => redirect("/login"), :via => [:get, :post]
  match '/auth/:provider/callback' => 'user_sessions#create_omniauth', :via => [:get, :post]
  match '/auth/:provider/disconnect' => 'user_sessions#destroy_omniauth', :as => :destroy_auth, :via => :delete

Any ideas what could be wrong?

Edit: I had the same problem with Google authorization.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Updating gems to their newest versions (omniauth 1.6.1 and omniauth-facebook 4.0.0) with:

bundle update omniauth
bundle update omniauth-facebook

solved the issue. I am leaving this for future reference.

Edit:

Same thing worked for google authorization:

bundle update omniauth-google-oauth2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...