We've got an Asp Net Core MVC application, whith the following configuration to authenticate over the API:
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(opt =>
{
opt.Cookie.Name = "appName";
opt.LoginPath = "/Account/SignIn";
opt.LogoutPath = "/Account/Logout";
opt.ReturnUrlParameter = "returnUrl";
});
It uses HttpContext to store Bearer access_token:
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity), authProperties);
All the pages in the application are standard MVC views, but some of them have built-in AngularJS controllers.
How can we get access token in AngularJS controller to access the API?