草庐IT

auth_response

全部标签

ruby-on-rails - 使用 HTTP.get_response 检索 Facebook 访问 token 时出现 Rails EOF 错误

我试图在我的网站上实现使用Facebook登录功能,但在尝试从Facebook取回访问token时遇到障碍。这是我的代码:ifparams[:error_reason]=="user_denied"thenflash[:error]="TologinwithFacebook,youmustclick'Allow'toletthesiteaccessyourinformation"redirect_to:loginelsifparams[:code]thentoken_uri=URI.parse("https://graph.facebook.com/oauth/access_token

ruby-on-rails - 在 Rails 中获取 "Incomplete response received from application"

有人可以帮忙吗?我的堆栈是带有nginx/passenger和ruby​​2.2.2的ubuntu-server14.04。我无法使我的项目投入生产。在开发中一切运行正常。secret.ymlproduction:secret_key_base:secret_token:服务器server{listen80;server_namelogvs.local;passenger_enabledon;passenger_app_envdevelopment;root/var/www/logvs/public;}错误日志App2532stderr:[2015-06-0722:56:01.4724

ruby-on-rails - 活跃商家 : How to authorise cards when using gateways that do not support the void operation?

我正在使用ActiveMerchant开发RubyonRails应用程序的计费组件。我们选择的支付网关是PaymentExpress.我看到的代码示例如下所示,使用authorize()和void()来测试卡的有效性:deftest_card!auth_response=gateway.authorize(100,card)gateway.void(auth_response.authorization)ifauth_response.success?raiseAuthorizationFailed.new(auth_response)unlessauth_response.succe

ruby-on-rails - Rails 中的推杆 : "Unknown auth_key" - server side not triggering events

我正在尝试将Pusher插入到我已经很晚的Rails应用程序中。客户端工作正常-使用PusherEventCreator触发所需的javascript。但是服务器端不工作:在我的通知Controller中使用以下代码创建要测试的操作:Pusher.trigger('private-4','new_message',{:from=>"christian",:subject=>"hello"})给出这个错误:Pusher::AuthenticationError(Unknownauth_key):app/controllers/notifications_controller.rb:57:

ruby - 没有将 HTTParty::Response 隐式转换为字符串

当我尝试将某种响应解析为JSON时,出现以下错误。如果万一解析失败,我会在我的代码中引发JSON::ParserError。但是这种异常不属于这个解析器错误。不知道为什么会抛出这种错误?以及如何挽救这个错误?代码:beginparsed_response=JSON.parse(response)rescueJSON::ParserError=>enilend错误:ATypeErroroccurredinbackgroundat2014-11-1603:01:08UTC:noimplicitconversionofHTTParty::ResponseintoString

ruby-on-rails - 在 Rails 中,我可以在它返回之前在 Action 中访问 response.body 吗?

在Rails中,我可以在action返回之前访问response.body吗?假设我想在它返回之前做一些最终的字符串替换,我可以访问response.body,即View返回的响应吗? 最佳答案 在你的Controller中尝试after_filter。您应该可以从那里编辑您的response.body。对我来说,我需要删除xml中的一些ASCII字符,因此我这样做了。after_filter:sanitize_xmldefsanitize_xml#cleantheresponsebodybyaccessingresponse.bo

ruby - HTTParty parsed_response 返回一个 String 而不是 Hash

如果您收到响应代码200,HTTPParty的parsed_response方法会返回一个哈希值,否则无论网络服务器是否返回XML响应,它都会返回一个字符串。HTTParty.get(post_url).parsed_response.class#Dependsonresponsecode即使出现403,亚马逊也会提供XML(解释出了什么问题)。我错过了什么吗? 最佳答案 HTTPParty根据HTTP响应的Content-Typeheader解析其#parsed_response。验证该HTTPheader的值是什么。在您的情况下

ruby - 通过 Rack::Auth::Basic 有选择地允许某些 url

我已经建立了一个我希望得到最低限度安全保护的博客(即,我只是想将我不认识的随机人员拒之门外,我并没有尝试实现类似NSA的安全措施)。我正在使用toto使用Rack::Auth::Basic来“保护”站点。我想通过index.xml以便博客读者能够在不处理密码的情况下阅读提要(是的,我知道这是我的“安全性”中的一个大漏洞).如何让Rack::Auth::Basic通过这个url?这就是我向网站添加基本身份验证的方式:useRack::Auth::Basic,"blog"do|username,password|[username,password]==['generic','stupid

ruby-on-rails - 找不到“twitter/bootstrap/responsive.less”

我正在尝试将我的应用程序移动到另一台服务器,但我目前遇到以下错误。'twitter/bootstrap/responsive.less'wasn'tfound(in/home/rails/**/app/assets/stylesheets/bootstrap_and_overrides.css.less)我的gemfile中没有:assetsblock——因此之前针对此问题的解决方案不适用于我的情况。这是我的Gemfilesource'https://rubygems.org'#BundleedgeRailsinstead:gem'rails',github:'rails/rails'

ruby-on-rails - NoMethodError(#<Elasticsearch::Model::Response::Result> 的未定义方法 `highlight'

我将为我的ruby​​onrails项目使用Elasticsearch。当我搜索一些在我的文章中使用过多的词时,出现此错误。NoMethodError(undefinedmethod`highlight'for#)我在日志制作中得到了这个。这就是我所做的一切:在Controller中:#POST/search/articledefsearchrenderjson:Article.search(params[:query]),each_serializer:ElasticsearchResultsSerializerend这是我的article.rb模型#default_scope{or