Sha256: 29a9d500e2275b809ed5e064dcad2ccc83e56be136bcbeca52b246fee16c9871

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 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
        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

2 entries across 2 versions & 1 rubygems

Version Path
devise_oauth2_providable-1.1.1 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-1.1.0 lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb