简体   繁体   English

如何解决“ OmniAuth :: Strategies :: OAuth2 :: CallbackError”错误?

[英]How to solve “OmniAuth::Strategies::OAuth2::CallbackError” error?

I am using Omniauth in a Rails application for login, my omniauth.rb, is as show below: 我在Rails应用程序中使用Omniauth进行登录,我的omniauth.rb如下所示:

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
   provider :facebook, 'xxxxxxx', 'xxxxxxx'
   provider :google_oauth2, 'xxxxxxxxx','xxxxxxxx'
end

When a user attempts to login (via Facebook or Goolge) and denies permissions, get the following error: 当用户尝试登录(通过Facebook或Goolge)并拒绝权限时,出现以下错误:

 OmniAuth::Strategies::OAuth2::CallbackError 

with this parameters: 具有以下参数:

{"error"=>"access_denied",
 "error_code"=>"200",
 "error_description"=>"Permissions error",
 "error_reason"=>"user_denied",
 "state"=>"60daee5f78d9cc28972050ae8ca8f950bb4ed5958302bcea"}

if the user accept, no problem and everything works fine. 如果用户接受,则没问题,一切正常。

I've tried some of the possible solutions related with this error, and listed on this website, but none solved my problem. 我尝试了一些与此错误相关的可能解决方案,并在此网站上列出,但没有一个解决我的问题。 For example: 例如:

How to rescue OmniAuth::Strategies::OAuth2::CallbackError? 如何挽救OmniAuth :: Strategies :: OAuth2 :: CallbackError?

Omniauth+facebook error when trying to cancel the popup 尝试取消弹出窗口时出现Omniauth + facebook错误

Please, I need help to solve this problem. 请,我需要帮助来解决这个问题。

there is another thread (posted here) with a solution that could help you. 还有另一个线程(在此处发布),其中提供了可以帮助您的解决方案。 But it always redirects to a general failure page for every type of error; 但是对于每种类型的错误,它总是重定向到常规故障页面。 meaning that regardless of the provider, it will redirect to the same error page. 这意味着无论提供者如何,它都将重定向到同一错误页面。

How to rescue OmniAuth::Strategies::OAuth2::CallbackError? 如何挽救OmniAuth :: Strategies :: OAuth2 :: CallbackError?

如果将Devise与OmniAuth一起使用,则需要跳过多余的omniauth.rb初始化程序,而只需在initializers / devise.rb内部配置config.provider“ KEY”,“ SECRET”,然后继续执行即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解救OmniAuth :: Strategies :: OAuth2 :: CallbackError? - How to rescue OmniAuth::Strategies::OAuth2::CallbackError? 在OmniAuth中处理OmniAuth :: Strategies :: OAuth2 :: CallbackError - Handling OmniAuth::Strategies::OAuth2::CallbackError in OmniAuth 与omniauth-facebook的Rails Facebook登录错误 - OmniAuth :: Strategies :: OAuth2 :: CallbackError - Rails Facebook login error with omniauth-facebook - OmniAuth::Strategies::OAuth2::CallbackError ClassLink Devise OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected - ClassLink Devise OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected Ruby on Rails设计Oauth-facebook OmniAuth :: Strategies :: OAuth2 :: CallbackError - Ruby on Rails Devise Oauth-facebook OmniAuth::Strategies::OAuth2::CallbackError 使用Google Oauth2的Omniauth会出现加载错误 - Omniauth with Google Oauth2 gives a loading error Omniauth与Linkedin Oauth2 - Omniauth with Linkedin Oauth2 Linkedin Omniauth gem 'omniauth-linkedin-oauth2' 验证失败:invalid_credentials: OAuth2::Error - Linkedin Omniauth gem 'omniauth-linkedin-oauth2' giving Authentication failure! invalid_credentials: OAuth2::Error OAuth2和Omniauth之间的区别 - difference between OAuth2 and Omniauth 如何在不使用omniauth的情况下使用oauth2连接到网站? - How to connect to website using oauth2 WITHOUT using omniauth?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM