Sha256: 47702cbf57ba82b66a6e7806dc53ac88d3b17b25d09903261a8885d0f4acf30f

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 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!
        if client && code = client.authorization_codes.find_by_token(params[:code])
          success! code.user
        elsif !halted?
          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

4 entries across 4 versions & 1 rubygems

Version Path
devise_oauth2_providable-1.0.5 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-1.0.4 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-1.0.3 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-1.0.2 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb