How to set a cookie and redirect the user to another url logged in?

Solution
resp = make_response(render_template(url))
resp.set_cookie('userID', user)
return resp