You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
It's hard to make a plunkr example, but it's easy to reproduce.
As I have a SPA I do authentication serverside through $http (webAPI). I create a $http method which calls a login functions on my backend server, this will set a cookie to authenticate.
After $http is complete I check my cookies:
public get isAuthenticated(): boolean
{
var cookie1: string = $cookie['.ASPXAUTH'];
var cookie2: string = $cookie['.ASPXAUTH_USERID'];
console.log(cookie1, cookie2);
console.log(document.cookie);
if (cookie1 && cookie2)
{
return true;
}
return false;
}
Odd part is that the variables cookie1 and cookie2 are empty, but document.cookie contains the newly set cookies.
After a page refresh all is fine, it seems that $cookie doesn't recognize cookies after they have been set by an ajax call.
The text was updated successfully, but these errors were encountered:
Hi @rogier21, this is a duplicate of #7631 and will be resolved in Angular 1.4. In the mean time you can set a timeout of at least 100ms and check the cookies again in order to see the updated cookies after the http response.
It's hard to make a plunkr example, but it's easy to reproduce.
As I have a SPA I do authentication serverside through $http (webAPI). I create a $http method which calls a login functions on my backend server, this will set a cookie to authenticate.
After $http is complete I check my cookies:
Odd part is that the variables
cookie1
andcookie2
are empty, butdocument.cookie
contains the newly set cookies.After a page refresh all is fine, it seems that $cookie doesn't recognize cookies after they have been set by an ajax call.
The text was updated successfully, but these errors were encountered: