From 8f14830c8a7493cd4cbeaaddba7c221b1eda22ec Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 28 May 2024 14:31:20 -0500 Subject: [PATCH] Remove external auth keys when they're done being used --- src/actions/auth.ts | 5 +++++ src/actions/external-auth.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/src/actions/auth.ts b/src/actions/auth.ts index 33684075a..bd5dd726b 100644 --- a/src/actions/auth.ts +++ b/src/actions/auth.ts @@ -224,6 +224,11 @@ export const logOut = () => // Clear the account from Sentry. unsetSentryAccount(); + // Remove external auth entries. + localStorage.removeItem('soapbox:external:app'); + localStorage.removeItem('soapbox:external:baseurl'); + localStorage.removeItem('soapbox:external:scopes'); + dispatch({ type: AUTH_LOGGED_OUT, account, standalone }); toast.success(messages.loggedOut); diff --git a/src/actions/external-auth.ts b/src/actions/external-auth.ts index 38ae92800..45edb8ba5 100644 --- a/src/actions/external-auth.ts +++ b/src/actions/external-auth.ts @@ -99,5 +99,6 @@ export const loginWithCode = (code: string) => .then((token: Record) => dispatch(authLoggedIn(token))) .then(({ access_token }: any) => dispatch(verifyCredentials(access_token as string, baseURL))) .then((account: { id: string }) => dispatch(switchAccount(account.id))) + .then(() => localStorage.removeItem('soapbox:external:baseurl')) .then(() => window.location.href = '/'); };