'Set a cookie recording OAuth result'

def set_cookie(self, handler, access_token):

    kwargs = {'path': self.base_url, 'httponly': True}
    if (handler.request.protocol == 'https'):
        kwargs['secure'] = True
    app_log.debug('Setting    oauth    cookie    for    %s:    %s,    %s', handler.request.remote_ip, self.cookie_name, kwargs)
    handler.set_secure_cookie(self.cookie_name, access_token, **kwargs)
