Skip to content

Conversation

@agriyakhetarpal
Copy link
Member

Warning

This PR is not yet complete, and needs changes on the sharing service as well.

We need to rely on the server to also set an HttpOnly cookie for session persistence and lock down CSP and eliminate inline scripts, because XSS could steal the in-memory token.

Comment on lines +255 to +271
/**
* Perform a "log out"-like action by asking the server to clear the
* HttpOnly cookie, and then drop our in-memory token.
*/
async logout(): Promise<void> {
const endpoint = new URL('auth/logout', this.api_url);
try {
await fetch(endpoint, {
method: 'POST',
credentials: 'include',
headers: await this.makeHeaders()
});
} finally {
this._token = undefined;
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires an auth/logout API endpoint.

@krassowski krassowski added the enhancement New feature or request label Aug 14, 2025
@agriyakhetarpal agriyakhetarpal marked this pull request as draft August 19, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants