I have a login service which passes user login information to my application when I login. This will call first page of my application on successful login. The user info is passed as part of a cookie in this request.
I am trying to read these cookies from the request in my Web API request using the below code.
CookieHeaderValue getAccessUserInfo = request.Headers.GetCookies("GAUSERINFO").FirstOrDefault();
if (getAccessUserInfo != null)
{
userInfo = getAccessUserInfo["GAUSERINFO"].Values.Get("corporate_id");
Logger.Info(string.Format("User Cookie {0}", userInfo));
return userInfo;
}
But if I am trying to read the same cookie from javascript or angular js, I am not able to see that cookie in the collection. Below is the code I am using to read the cookie in angular js.
console.log($document[0].cookie);
This is the cookie I can see from the result. The cookie I am expecting is GAUSERINFO along with the below cookies.
Is there a way to read these cookies from angular js or atleast pass that request body to the API so that I can read the cookie in my API using C# code.