Module: OAuth2::Provider::Models::AccessToken::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#refresh_with(refresh_token) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oauth2/provider/models/access_token.rb', line 41

def refresh_with(refresh_token)
  if refresh_token && token = find_by_refresh_token(refresh_token)
    if token.refreshable?
      new(:authorization => token.authorization).tap do |result|
        if result.authorization.expires_at && result.authorization.expires_at < result.expires_at
          result.expires_at = result.authorization.expires_at
        end
        result.save!
      end
    end
  end
end