How to check for login status in UmbracoApiController
I am trying to setup an endpoint that can return information regarding the user login status.
My method looks like this:
[HttpGet]
public ActionResult IsLoggedIn()
{
// this always returns false
bool isLoggedIn = _memberManager.IsLoggedIn();
if (isLoggedIn)
{
return Ok("User is logged in");
}
else
{
return BadRequest();
}
}
For some reason, I cannot seem to be able to get a positive indication that the user is logged in. Even though I am sending along the auth cookie called ".AspNetCore.Identity.Application" that I got returned after the login.
On the other hand, in my login endpoint, if I check the status right after the succesfull login, the IsLoggedIn method returns true (obviously) 😉
Does anyone have a clue what I might be missing in my IsLoggedIn endpoint?
Never mind, I seem to have messed up some configuration in startup.cs.
I fixed it by referencing a clean Umbraco 13.2.2 - and changing to minimal hosting model as well 😉
How to check for login status in UmbracoApiController
I am trying to setup an endpoint that can return information regarding the user login status.
My method looks like this:
For some reason, I cannot seem to be able to get a positive indication that the user is logged in. Even though I am sending along the auth cookie called ".AspNetCore.Identity.Application" that I got returned after the login.
On the other hand, in my login endpoint, if I check the status right after the succesfull login, the IsLoggedIn method returns true (obviously) 😉
Does anyone have a clue what I might be missing in my IsLoggedIn endpoint?
Never mind, I seem to have messed up some configuration in startup.cs. I fixed it by referencing a clean Umbraco 13.2.2 - and changing to minimal hosting model as well 😉
is working on a reply...