English 中文(简体)
Railways 3.1 OAuth Provider “invalid_grant” with art_oauth2_providable
原标题:Rails 3.1 OAuth Provider "invalid_grant" with devise_oauth2_providable

我正试图建立一个“ o2”提供者,利用一项已经过时和设计的申请。 使用者:

class User < ActiveRecord::Base

  has_many :authentications
  has_many :graphs

  devise :database_authenticatable,
    :registerable, 
    :recoverable, 
    :rememberable, 
    :trackable, 
    :validatable, 
    :omniauthable, 
    :token_authenticatable,
    :oauth2_providable, 
    :oauth2_password_grantable,
    :oauth2_refresh_token_grantable,
    :oauth2_authorization_code_grantable

.......

}

其他一切都按预期执行,但当我在当地管理时,我正发现以下错误,并试图利用 o2gem(0.5.0)与我的客户联系。

我最后说:

提出例外:

e.to_yaml
"--- !ruby/exception:OAuth2::Error
response: &70266332040280 !ruby/object:OAuth2::Response
  response: &70266332040340 !ruby/object:Faraday::Response
    env:
      :method: :post
      :body: !  {"error":"invalid_grant","error_description":"invalid authorization
        code request"} 
      :url: !ruby/object:Addressable::URI
        validation_deferred: false
        scheme: http
        normalized_scheme: !!null 
        uri_string: !!null 
        hash: !!null 
        host: localhost
        authority: !!null 
        normalized_host: !!null 
        port: 3000
        normalized_port: !!null 
        path: /oauth2/token
        normalized_path: !!null 
        query: !!null 
        normalized_query: !!null 
      :request_headers:
        Content-Type: application/x-www-form-urlencoded
      :parallel_manager: !!null 
      :request:
        :proxy: !!null 
      :ssl: {}
      :status: 400
      :response_headers:
        content-type: application/json
        x-ua-compatible: IE=Edge
        cache-control: no-cache
        x-runtime:  0.119701 
        content-length:  82 
        server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
        date: Wed, 05 Oct 2011 14:40:10 GMT
        connection: close
      :response: *70266332040340
    on_complete_callbacks: []
  options:
    :parse: !!null 
  error: !ruby/exception:OAuth2::Error
    response: *70266332040280
    code: invalid_grant
    description: invalid authorization code request
  parsed:
    error: invalid_grant
    error_description: invalid authorization code request
code: invalid_grant
description: invalid authorization code request
"

我也要指出,没有国家,在最近的草案(http://tools.ietf.org/html/draft-ietf-oauth-v2-22)中,要求国家退席。 这个问题吗?

关于产出,我没有发现服务器产出中的任何明显错误:

rel=“nofollow”>http://pastie.org/2644028

现在还有一点值得注意:我看到几次选举考试,但我从未看到任何数据被插入到各种表格中,特别是不批准在放弃这一例外之前出现的编码。

最佳回答

我没有铁路天花,但我确实知道我在Gite Hub周围的路,我设法找到少数人承诺为他们 for。 通过将几个有效的固定点并入一个地点,我设法为我打上了一只 fine子:

我确定,作为我在Gemfile的消息来源,现在,追随者工作得当!

现在,我只需要研究如何阻止人们接触到已经到期的病痛,或向花钱反应中注入用户。 工作工作。

问题回答

在审查了这些询问后,它像现在这样认为过去了“价值”到期。 下面是“oauth2_providable Code”,称这一错误:

module Devise
  module Strategies
    class Oauth2AuthorizationCodeGrantTypeStrategy < Oauth2GrantTypeStrategy
      def grant_type
         authorization_code 
      end

      def authenticate!
        if client && code = AuthorizationCode.valid.find_by_token(params[:code])
          success! code.user
        elsif !halted?
          oauth_error! :invalid_grant,  invalid authorization code request 
        end
      end
    end
  end
end

这种有效的范围检查,看看目前时间是否大于或等于授权期限。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签