Forum Discussion
How to Expires access token on sign out?
runrunrun
I don't get the problem "user can't sign out", maybe something to do with the azure ad authentication?
Thanks for replying.
Okay, let me try to explain with some code.
public ActionResult Index()
{
if (Session["access_token"] == null)
return RedirectToAction("Index", "Admin");
return View();
}First my app check if there is "access_token" in session, if there is not it will redirect to this link
It will prompt the user to login using their account, then it fill Session["access_token"] with the token from authenticationResult.AccessToken; so they can see power bi reports in my apps. Then there is logout button (see the code below)
public ActionResult Logout()
{
Session.Abandon();
Session["access_token"] = null;
return Redirect("https://login.windows.net/common/oauth2/logout");
}But if they press back button (go back one page), user still can see the reports. After I debug it, the authenticationContext.AcquireTokenByAuthorizationCodeAsync not prompting user to login again, it automatically filled Session["access_token"] with the token.
I'm not using Azure AD. I registered my app via https://dev.powerbi.com/apps.
Hope you can understand my problem (and my english). Thanks :).