Logout token does not disappear
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I use an Azure static web app, but there is a problem where the token is not deleted even if I log out.
I've been struggling with this problem for several days. please help me.
In the Azure Statcic web app, the token is not deleted even if I log out.

Tokens are easily erased locally.

Below is the Azure Function app code for Logout.
module.exports = async function (context, req) {
if (req.cookies && req.cookies.token) {
context.res = {
status: 200,
cookies: [{
name: "token",
value: "",
path: "/",
httpOnly: true,
expires: new Date(0),
sameSite: "None",
secure: true
}]
};
} else {
context.res = {
status: 200
};
}
};
Below is the Azure static web app client code for Logout.
const logout = () => {
axios.delete("/api/accountDelete", { withCredentials: true }).then(() => {
alert("You have logged out.")
state.account.id = null;
state.account.name = "";
localStorage.removeItem('account'); //추가
Cookies.remove('token', { path: '/', sameSite: 'None', secure: true });
}).catch((error) => {
console.error("Logout failed: ", error);
});
};
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.