mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 22:19:41 +01:00
fix: logout using custom logout endpoint
This commit is contained in:
@@ -5,6 +5,7 @@ const ENDPOINTS = {
|
|||||||
token: "/connect/token",
|
token: "/connect/token",
|
||||||
revoke: "/connect/revocation",
|
revoke: "/connect/revocation",
|
||||||
temporaryToken: "/account/token",
|
temporaryToken: "/account/token",
|
||||||
|
logout: "/account/logout",
|
||||||
};
|
};
|
||||||
|
|
||||||
class TokenManager {
|
class TokenManager {
|
||||||
@@ -54,19 +55,13 @@ class TokenManager {
|
|||||||
async revokeToken() {
|
async revokeToken() {
|
||||||
const token = await this.getToken();
|
const token = await this.getToken();
|
||||||
if (!token) return;
|
if (!token) return;
|
||||||
const { access_token, refresh_token } = token;
|
const { access_token } = token;
|
||||||
|
|
||||||
await http.post(`${constants.AUTH_HOST}${ENDPOINTS.revoke}`, {
|
await http.post(
|
||||||
token: access_token,
|
`${constants.AUTH_HOST}${ENDPOINTS.logout}`,
|
||||||
client_id: "notesnook",
|
null,
|
||||||
token_type_hint: "access_token",
|
access_token
|
||||||
});
|
);
|
||||||
|
|
||||||
await http.post(`${constants.AUTH_HOST}${ENDPOINTS.revoke}`, {
|
|
||||||
token: refresh_token,
|
|
||||||
client_id: "notesnook",
|
|
||||||
token_type_hint: "refresh_token",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveToken(tokenResponse) {
|
saveToken(tokenResponse) {
|
||||||
|
|||||||
Reference in New Issue
Block a user