class RefreshToken < ActiveRecord::Base
  include Oauth2Token
  self.default_lifetime = 24.hours
  has_many :access_tokens

  def scopes
    s = read_attribute(:scopes)
    s.nil? ? [] : s.split(',')
  end

  def scopes=(arr)
    val = arr.nil? ? nil : arr.join(',')
    write_attribute(:scopes, val)
  end

  private
  def setup
    super
    self.token = SecureToken.generate
  end
end

class RefreshToken < ActiveRecord::Base
  include Oauth2Token
  self.default_lifetime = 2.weeks
  has_many :access_tokens

  def scopes
    s = read_attribute(:scopes)
    s.nil? ? [] : s.split(',')
  end

  def scopes=(arr)
    val = arr.nil? ? nil : arr.join(',')
    write_attribute(:scopes, val)
  end

  private
  def setup
    super
    self.token = SecureToken.generate
  end
end

Change refresh token timeout to 2 weeks
Change refresh token timeout to 2 weeks

Since the CLI client now supports refresh tokens, setting the refresh
token timeout to two weeks will allow command-line users to stay logged
in for that amount of time before they have to re-enter their creds.
