Sha256: 7036ec7711c0920903a2af71ae27cb158ecd0ef0b8e6989b495286a561ecb6b3

Contents?: true

Size: 691 Bytes

Versions: 17

Compression:

Stored size: 691 Bytes

Contents

require 'devise/oauth2/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::Oauth2::REFRESH_TOKEN_ENV_REF] = refresh_token
          success! refresh_token.user
        else
          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

17 entries across 17 versions & 1 rubygems

Version Path
devise_oauth2_rails4-2.1.8 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.7 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.6 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.5 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.4 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.3 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.0.3 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.1.0 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.0.2 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.0.1 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-2.0.0 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.8 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.7 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.6 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.5 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.4 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb
devise_oauth2_rails4-1.1.3 lib/devise/oauth2/strategies/oauth2_refresh_token_grant_type_strategy.rb