Sha256: 4d57d142a8776530eb25fba661d2618f2541f38c235e10f4c2dd88c7f3ec3fc3

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

require 'devise/oauth2_providable/strategies/oauth2_grant_type_strategy'

module Devise
  module Strategies
    class Oauth2FacebookGrantTypeStrategy < Oauth2GrantTypeStrategy
      def grant_type
        'facebook'
      end

      def authenticate_grant_type(client)
        resource = mapping.to.find_for_authentication(:uid => params[:uid], :provider => 'facebook')
        if validate(resource) { params[:token] == resource.fb_token }
          success! resource
        else
          oauth_error! :invalid_grant, 'invalid facebook authentication request'
        end
      end
    end
  end
end

Warden::Strategies.add(:oauth2_facebook_grantable, Devise::Strategies::Oauth2FacebookGrantTypeStrategy)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mustwin_devise_oauth2_providable-1.1.6 lib/devise/oauth2_providable/strategies/oauth2_facebook_grant_type_strategy.rb