Frage

I am trying to secure a Rails 4 API by making it a OAuth2 Provider.

Added the gem Mongoid '4.0.0' (from the master branch of the Git Repo) to make it work with Rails 4.

Now I wish to use Doorkeeper gem to make the API an OAuth2 Provider. I guess Doorkeeper doesn;t support Mongoid 4 (Source: https://github.com/applicake/doorkeeper/issues/224)

Moreover, I can't use Mongoid 3.1.2 as this wont work in Rails 4.

I prefer not to use the gem 'oauth-plugin' due to too much of Boilerplate code it injects.

Please suggest, Is there anything I can do to get it working?

Thank you in advance! :-)

War es hilfreich?

Lösung

Moped’s BSON has been removed of bson gem 2.0, but you may add this manually.

Create config/initializers/bson/object_id.rb Into file add:

module Moped
  module BSON
    ObjectId = ::BSON::ObjectId

    class Document < Hash
      class << self
        def deserialize(io, document = new)
          __bson_load__(io, document)
        end

        def serialize(document, io = "")
          document.__bson_dump__(io)
        end
      end
    end
  end
end

Link to original article

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top