Sha256: 92fcc043f44859f43616d241c38a2a10d45bba5ce5a109bee670a839c7b53d0e

Contents?: true

Size: 695 Bytes

Versions: 9

Compression:

Stored size: 695 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.valid.find_by_token(params[:refresh_token])
          env['oauth2.refresh_token'] = 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

9 entries across 9 versions & 1 rubygems

Version Path
devise_oauth2_providable-0.3.8 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.7 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.6 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.5 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.4 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.3 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.2 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.1 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_providable-0.3.0 lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb