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

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

Instance Method Summary collapse

Instance Method Details

#random_tokenObject


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

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

#unique_random_token(attribute) ⇒ Object


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

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