module Grape::OAuth2::Mongoid::Client

Grape::OAuth2 Client role mixin for Mongoid ORM. Includes all the required API, associations, validations and callbacks.

Public Class Methods

authenticate(key, secret = nil) click to toggle source
# File lib/grape_oauth2/mixins/mongoid/client.rb, line 26
def self.authenticate(key, secret = nil)
  if secret.nil?
    find_by(key: key)
  else
    find_by(key: key, secret: secret)
  end
end

Public Instance Methods

generate_keys() click to toggle source
# File lib/grape_oauth2/mixins/mongoid/client.rb, line 36
def generate_keys
  self.key = Grape::OAuth2::UniqueToken.generate if key.blank?
  self.secret = Grape::OAuth2::UniqueToken.generate if secret.blank?
end