Sha256: 4e652f92c9951059a4cd1851737880afb900f52024bb9a33e983bfeb40bd96e7

Contents?: true

Size: 735 Bytes

Versions: 9

Compression:

Stored size: 735 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_grant_type(client)
        if refresh_token = client.refresh_tokens.find_by_token(params[:refresh_token])
          env[Devise::Oauth2Providable::REFRESH_TOKEN_ENV_REF] = refresh_token
          success! refresh_token.user
        else
          oauth_error! :invalid_grant, I18n.t("devise.failure.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
brycesch-devise_oauth2_providable-1.2.8 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.7 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.6 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.5 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.4 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.3 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.2 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.1 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
brycesch-devise_oauth2_providable-1.2.0 lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb