Module: OAuth2::Provider::Models::RandomToken::ClassMethods

Defined in:
lib/oauth2/provider/models.rb

Instance Method Summary collapse

Instance Method Details

#random_tokenObject



45
46
47
# File 'lib/oauth2/provider/models.rb', line 45

def random_token
  OAuth2::Provider::Random.base62(48)
end

#unique_random_token(attribute) ⇒ Object



49
50
51
52
# File 'lib/oauth2/provider/models.rb', line 49

def unique_random_token(attribute)
  key = random_token while (key.nil? || where(attribute => key).exists?)
  key
end