背景
我有一个omniauth-oauth2子类策略在我的rails应用程序上工作。当刷新access_token时,我发现我需要创建OAuth2::AccessToken。但要创建它,似乎需要OAuth2::Client,我认为它可以从"omniauth-oauth2子类策略“中获得。
找到了这个解决方案,这是他们如何解决的,以获得一个战略
# the initial param:nil is meant to be a rack object, but since
# we don't use it here, we give it a nil
strategy = Om
我在我的Rails应用程序中通过Devise使用OmniAuth。我正在尝试测试我的回调方法是否被正确调用,以及是否正常工作。我当前在运行规范时收到错误。
错误:
Failure/Error: get user_omniauth_authorize_path(:facebook)
ActionController::UrlGenerationError:
No route matches {:action=>"/users/auth/facebook", :controller=>"users/omniauth_callbacks"} mis
我使用omniauth而不使用devise进行身份验证,因为我喜欢它的简单性。除了omniauth-facebook之外,我还使用omniauth-identity来提供电子邮件/pw身份验证。
介绍了如何设置自定义的注册和登录页面。但是仍然可以访问identity提供的默认路由(/auth/identity和/auth/identity/register)。
我想让这些在我的控制之下,因为我只想让受邀请的用户注册。有没有办法覆盖那些由机架中间件提供的路由?
试着只是
match "/auth/identity", to: "somewhere#else"
不会
我正在使用Omniauth for Rails 3.2.3应用程序。
我已经配置了on_failure回调,如下所示。
OmniAuth.config.on_failure = Proc.new do |env|
UsersController.action(:omniauth_failure).call(env)
end
这将处理错误"OmniAuth::Strategies::CallbackError“,但不会处理"OmniAuth::Strategies::Facebook::NoAuthorizationCodeError".
如何处理此error?.Su
我想知道哪些提供程序已加载以供使用。我试过了:
OmniAuth::Strategies.constants # a method provided by the standard lib Module class
# => [:Developer, :OAuth, :Twitter]
还有这个:
OmniAuth.strategies.inspect # a method provided by the OmniAuth class, but which has no documentation or comments around it.
# => [OmniAuth::St
我试图通过在向发出请求时提供伪造的身份验证散列来测试我的/auth/facebook登录过程,如和所述。问题是,当我打开测试模式时,请求返回为错误,这与未打开测试模式时的行为相同。
user_management.feature
Feature: User management
@omniauth_test
Scenario: Login
Given a user exists
And that user is signed in
web_steps.rb
...
And /^that user is signed in$/ do
visit
我在设置一个定制的OmniAuth策略以用于Devise方面存在问题。我在这里使用下面的gem,但是我不确定如何正确地加载这个文件并使用它。
基于自述文件,我为我的提供者创建了一个特定的子类,我不知道把这个文件放在哪里,所以我将它放在基于这个lib/strategies/myauth.rb的中。文件看起来像这样。删除提供程序特定的代码。
module OmniAuth
module Strategies
class Myauth < OmniAuth::Strategies::XAuth
...
end
end
end
基于这个,我在config/
你好,我在我的应用程序中使用杂音。我创建了应用程序,而没有使用devise。所以我手动编写了所有的加密方法。我正在尝试将imniauth集成到我的应用程序中,但我遇到了很多问题。我做了一个认证控制器:
class AuthenticationsController < ApplicationController
def index
@authentications = current_user.authentications if current_user
end
def create
omniauth = request.env["omniauth
我试图在我的Rails应用程序中实现开放授权,以便用户可以使用他们的LinkedIn帐户登录。当我单击一个链接转到LinkedIn授权页面,然后确认我的LinkedIn凭据时,我会在我的应用程序中得到一个错误:
Unknown action
The action 'linkedin' could not be found for Devise::OmniauthCallbacksController
我几乎肯定问题就在我的路线文件里。许多教程要求添加以下一行:
devise_for :users, :controllers => { :omniauth_callback
我收到一个错误:
OmniAuth::Strategies::Facebook::NoAuthorizationCodeError (must pass either a
`code` parameter or a signed request (via `signed_request` parameter or a
`fbsr_XXX` cookie)):
它不是一直都会来的。它每隔一段时间就来一次,由空气制动器通知。
在谷歌搜索上有很多关于这个问题的链接,但都找不到合适的解决方案。有没有人?initializers目录下的omniauth.rb:
OmniAuth.config.lo