    def set_cookie(self, handler, access_token):
        """Set a cookie recording OAuth result"""
        kwargs = {'path': self.cookie_path, 'httponly': True}
        if (
            get_browser_protocol(handler.request) == 'https'
            or self.cookie_host_prefix_enabled
        ):
            kwargs['secure'] = True
        # load user cookie overrides
        kwargs.update(self.cookie_options)
        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)
        # set updated xsrf token cookie,
        # which changes after login
        handler._hub_auth_token_cookie = access_token
        _set_xsrf_cookie(
            handler,
            handler._xsrf_token_id,
            cookie_path=self.base_url,
            authenticated=True,
        )
Set a cookie recording OAuth result
jupyterhub/services/auth.py