logout(reload?: boolean): void {
abp.auth.clearToken();
abp.utils.setCookieValue(
AppConsts.authorization.encryptedAuthTokenName,
undefined,
undefined,
abp.appPath
);
if (reload !== false) {
location.href = AppConsts.appBaseUrl;
}
}
Why is it using this code instead of the deleteCookie
function?
No particular reason. It has been changed to deleteCookie
in aspnetboilerplate/module-zero-core-template@6cd84d7
.
deleteCookie(AppConsts.authorization.encryptedAuthTokenName, abp.appPath)
sets something like enc_auth_token=; expires=Fri, 23 Apr 2021 00:00:00 GMT; path=/
, where Fri, 23 Apr 2021 00:00:00 GMT
is 86400000 milliseconds (one day) ago.
getCookieValue
would return null
.setCookieValue(AppConsts.authorization.encryptedAuthTokenName, undefined, undefined, abp.appPath)
sets something like enc_auth_token=; path=/
, which is a session cookie.
getCookieValue
would return ''
(as of ABP v6.3).