AngularJS Web开发的新功能。当前,我有一个必须使用全局身份验证表单的应用程序。 SPA有多个部分页面/视图。为了在标签之间导航,我使用ngCookies存储客户登录信息。
If the user refreshes the page, I read the cookies and bring the related information for a given customer.
It is working fine but the problem arises when the user closes the application without clicking the logout button and the cookies remain in the browser.
So, the next time another customer logs onto the site, it reads the old cookies and bring the old customer information instead of currently logged-on user.
function writeLoginCustIDCookie(loginCustID) {
$cookies.put("LoginCustID", loginCustID, { path: '/' });
}
function getLoginCustIDCookie() {
return $cookies.get("LoginCustID");
}
请帮助我解决该问题。
答案 0 :(得分:0)
您将必须配置流。我的工作是这样:
withCredentials: true
添加到您的http请求中,以便发送cookie。这是我通常要做的。我想没什么疯狂的。