Sha256: 2031562d39b91e4e6fa8b65305fee075bba523c97c084bade2a7bd9252b58ef6

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

require 'devise/oauth2_providable/strategies/oauth2_grant_type_strategy'

module Devise
  module Strategies
    class Oauth2RefreshTokenGrantTypeStrategy < Oauth2GrantTypeStrategy
      def grant_type
        'refresh_token'
      end

      def authenticate!
        if client && refresh_token = client.refresh_tokens.find_by_token(params[:refresh_token])
          env[Devise::Oauth2Providable::REFRESH_TOKEN_ENV_REF] = refresh_token
          success! refresh_token.user
        elsif !halted?
          oauth_error! :invalid_grant, 'invalid refresh token'
        end
      end
    end
  end
end

Warden::Strategies.add(:oauth2_refresh_token_grantable, Devise::Strategies::Oauth2RefreshTokenGrantTypeStrategy)

Version data entries

4 entries across 4 versions & 1 rubygems

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