本文介绍了Omniauth:回调未触发,返回失败与“无效凭据”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Rails应用程序中的facebook身份验证使用 Omniauth gem执行,最近已停止工作。



问题是,回调中使用的控制器操作不会被触发,并且进程立即使用无效凭据消息跳过失败。 / p>

log:

 开始GET/ auth / facebook :ffff:127.0.0.1于2017-03-29 11:12:29 +0200 
启动GET/ auth / facebook / callback?code =< code>& state =<<<< ;状态>中for :: ffff:127.0.0.1于2017-03-29 11:12:30 +0200
启动GET/ auth / failure?message = invalid_credentials& origin =<< origin>>& = facebookfor :: ffff:127.0.0.1于2017-03-29 11:12:31 +0200
开始GET/ loginfor :: ffff:127.0.0.1于2017-03-29 11: 12:31 +0200
UserSessionsController处理#新建为HTML

路由:

  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 via => :删除

任何想法可能是错的?



编辑:
我与Google授权有同样的问题。

解决方案

将宝石更新到最新版本(omniauth 1.6.1和omniauth-facebook 4.0.0):

 软件包更新omniauth 
束更新omniauth-facebook

解决了这个问题。我要离开这个以备将来参考。



编辑:



对于Google授权:

 软件包更新omniauth-google-oauth2 


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.

解决方案

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

这篇关于Omniauth:回调未触发,返回失败与“无效凭据”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:20