lib/rack/oauth2/models/client.rb in rack-oauth2-server-2.0.1 vs lib/rack/oauth2/models/client.rb in rack-oauth2-server-2.1.0
- old
+ new
@@ -8,10 +8,11 @@
# Authenticate a client request. This method takes three arguments,
# Find Client from client identifier.
def find(client_id)
id = BSON::ObjectId(client_id.to_s)
Server.new_instance self, collection.find_one(id)
+ rescue BSON::InvalidObjectId
end
# Create a new client. Client provides the following properties:
# # :display_name -- Name to show (e.g. UberClient)
# # :link -- Link to client Web site (e.g. http://uberclient.dot)
@@ -27,10 +28,10 @@
def create(args)
redirect_uri = Server::Utils.parse_redirect_uri(args[:redirect_uri]).to_s if args[:redirect_uri]
scope = Server::Utils.normalize_scope(args[:scope])
fields = { :display_name=>args[:display_name], :link=>args[:link],
:image_url=>args[:image_url], :redirect_uri=>redirect_uri,
- :nodes=>args[:notes].to_s, :scope=>scope,
+ :notes=>args[:notes].to_s, :scope=>scope,
:created_at=>Time.now.to_i, :revoked=>nil }
if args[:id] && args[:secret]
fields[:_id], fields[:secret] = BSON::ObjectId(args[:id].to_s), args[:secret]
collection.insert(fields, :safe=>true)
else