module Doorkeeper::Orm::ActiveRecord::Mixins::AccessGrant

def generate_token

Returns:
  • (String) - token value
def generate_token
  @raw_token = Doorkeeper::OAuth::Helpers::UniqueToken.generate
  secret_strategy.store_secret(self, :token, @raw_token)
end

def plaintext_token

returning a present value for persisted tokens.
while hashing strategies do not, so you cannot rely on this value
Some strategies allow restoring stored secrets (e.g. symmetric encryption)

The stored refresh_token may be mapped and not available in cleartext.
We keep a volatile copy of the raw token for initial communication
def plaintext_token
  if secret_strategy.allows_restoring_secrets?
    secret_strategy.restore_secret(self, :token)
  else
    @raw_token
  end
end