问题
I have been using Flask-Login on <domain>/<app_1> for almost a year without issue. Recently, I built a second application with the same stack and deployed it to <domain>/<app_2>. Now, whenever I log into either app, it kicks me out of the other. Is there a reason for this? The apps have different databases and secret keys, and I would have assumed I could have two cookies for the same domain.
I'm not too familiar with cookies and am not sure how to debug this. I'm happy to provide headers or other information if people can tell me what is relevant.
回答1:
You need to configure the cookies to use separate paths.
app.config['REMEMBER_COOKIE_PATH'] = '/app_1'
来源:https://stackoverflow.com/questions/40440691/flask-login-not-working-with-two-applications-on-same-domain