草庐IT

OmniAuth

全部标签

ruby-openid:执行发现时未设置@socket

我在使用omniauth/openid时遇到了一些麻烦。在尝试进行身份验证时,我在日志中发现了这一点:OpenID::FetchingError:Errorfetchinghttps://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username:undefinedmethod`io'fornil:NilClass重要的是undefinedmethodio'fornil:NilClass来自openid/fetchers.rb,在下面的代码片段中:moduleNetclass

ruby-on-rails - 设计中的 ArgumentError::RegistrationsController#new 错误的参数数量(2 代表 0..1)

我在关注RyanbatesRailsCast的devise和omniauth(第235集-devise-and-omniauth-revised)。当我尝试使用Twitter登录时,标题中不断出现错误。defself.new_with_session(params,session)ifsession["devise.user_attributes"]new(session["devise.user_attributes"],without_protection:true)do|user|user.attributes=paramsuser.valid?end完整跟踪:C:/Ruby20

ruby-on-rails - 如何在多个环境中处理 OmniAuth 回调?

我有一个应用程序专门使用Facebook作为身份验证提供程序,并正确设置了生产模式的回调。为了让它工作,您需要为您的Facebook应用程序提供一个站点URL和一个用于回调的站点域,在我的例子中是http://appname.heroku.com和appname。heroku.com分别。问题是我的Controller设置为只允许经过身份验证的session,所以我无法在开发模式下查看我的应用程序,因为Facebook应用程序的域显然没有设置为本地主机。如何在不更改Facebook设置的情况下解决这个问题? 最佳答案 创建另一个域l

ruby-on-rails - Rails 3.1.rc4 中的 Omniauth

我正在使用最新版本的Rails,启动一个我将在3.1发布后部署的新应用程序,但我无法让omniauth工作。如果我只是将omniauth添加到我的Gemfile,它会bundle起来,但是当我运行rake、railss或几乎所有命令时,它会出错:nosuchfiletoload--omniauth/password有什么想法吗?是否有适用于Rails3.1的分支或分支?还是只有我遇到这个问题? 最佳答案 实际问题是bundler选择了旧版本的omniauth。为了帮助bundler选择正确的版本,请使用:gem'omniauth',

ruby - 如何使用 omniauth/oauth 对每秒登录数进行基准测试? ( ruby +rspec)

我想用一个(自己的)omniauth提供商来衡量每秒可以登录多少次。我需要了解此omniauth/oauth请求的性能如何,以及此身份验证是否具有可扩展性?到目前为止我得到了什么:defperformance_auth(user_count=10)bm=Benchmark.realtimedouser_count.timesdo|n|forkdoclick_on'Logout'omniauth_config_mock(:provider=>"foo",:uid=>n,:email=>"foo#{n}@example.net")visit"/account/auth/foo/"enden

ruby-on-rails - 如何编写 Rails 4 测试以使用 omniauth-google-oauth2 gem 创建 session ?

我正在尝试为使用omniauth-google-oauth2gem创建session编写测试。我是否需要将env["omniauth.auth"]变量与post:create一起传递?也许当我试图这样做时,我做错了。我得到的错误如下所示...Rake测试错误1)Error:SessionsControllerTest#test_should_get_create:NoMethodError:undefinedmethod`provider'fornil:NilClassapp/models/user.rb:6:in`from_omniauth'app/controllers/sessi

ruby-on-rails - 如何在 ruby​​ on rails 中为 gmail 联系人创建访问 token

我正在使用Omniauth请求用户gmail凭据,因此我可以稍后请求用户friend/联系人。现在,我正在使用身份验证请求为我生成的访问token,在OmniauthCallbacksController中获取好友列表。像这样classUsers::OmniauthCallbacksController如何使用存储在数据库中的凭据创建新的访问token,以便从不同的Controller调用googleAPI? 最佳答案 从here获取您的client_id和client_secret|.这是一个粗略的脚本,可以很好地工作。根据您的需

ruby-on-rails - 为什么 Devise/Omniauth 会向 URL 添加垃圾?

使用facebook登录后,我被重定向到/#_=_,其中显示主页。这种垃圾也出现在其他URL中,例如当注册失败并被重定向到/users/sign_in#_=_为什么会发生这种情况,我该如何解决? 最佳答案 如果你真的不想要它,一些简单的javascript就可以了:if(window.location.hash=="#_=_"){window.location.hash="";} 关于ruby-on-rails-为什么Devise/Omniauth会向URL添加垃圾?,我们在StackO

ruby-on-rails - 如何授权google-api-ruby-client?

我正在努力让google-api-ruby-clientgem按照这里的基本用法示例工作:基本用法require'google/apis/drive_v2'Drive=Google::Apis::DriveV2#Aliasthemoduledrive=Drive::DriveService.newdrive.authorization=...#SeeGoogleauthorSignetlibraries#SearchforfilesinDrive(firstpageonly)files=drive.list_files(q:"titlecontains'finances'")files

ruby-on-rails - minitest 测试和代码覆盖率

我使用mini-test来测试框架。我使用omniauthgem进行身份验证。我使用simplecov进行代码覆盖。我使用"bundleexecrake"或"rakeminitest:controllers"运行我的测试。我举一个Controller的例子。当我运行rakeminitest:controllers时,Controller代码覆盖率变为100%。但是,当我运行bundleexecrake时,Controller代码覆盖率变为60%。SessionsController.rb代码:classSessionsControllersessionController_测试.rbr