Sha256: b3fbae7db874836d249c4db4c223cfbe3f2b0bea0adcf240018527db778164a3

Contents?: true

Size: 644 Bytes

Versions: 12

Compression:

Stored size: 644 Bytes

Contents

require 'devise/oauth2_providable/strategies/oauth2_grant_type_strategy'

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

      def authenticate_grant_type(client)
        if code = client.authorization_codes.find_by_token(params[:code])
          success! code.user
        else
          oauth_error! :invalid_grant, 'invalid authorization code request'
        end
      end
    end
  end
end

Warden::Strategies.add(:oauth2_authorization_code_grantable, Devise::Strategies::Oauth2AuthorizationCodeGrantTypeStrategy)

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
brycesch-devise_oauth2_providable-1.1.7 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_rails4-1.1.2 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
mustwin_devise_oauth2_providable-1.1.6 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
mustwin_devise_oauth2_providable-1.1.5 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
mustwin_devise_oauth2_providable-1.1.4 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
mustwin_devise_oauth2_providable-1.1.3 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
insrc_devise_oauth2_providable-1.1.2 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-1.1.2 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
anjlab-devise-oauth2-providable-1.1.3 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
anjlab-devise-oauth2-providable-1.1.2 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
anjlab-devise-oauth2-providable-1.1.1 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
anjlab-devise-oauth2-providable-1.1.0 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb