Merge branch 'external-auth-fix' into 'main'

Remove external auth keys when they're done being used

See merge request soapbox-pub/soapbox!3039
This commit is contained in:
Alex Gleason 2024-05-28 19:48:15 +00:00
commit 407432cf39
2 changed files with 6 additions and 0 deletions

View File

@ -224,6 +224,11 @@ export const logOut = () =>
// Clear the account from Sentry. // Clear the account from Sentry.
unsetSentryAccount(); 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 }); dispatch({ type: AUTH_LOGGED_OUT, account, standalone });
toast.success(messages.loggedOut); toast.success(messages.loggedOut);

View File

@ -99,5 +99,6 @@ export const loginWithCode = (code: string) =>
.then((token: Record<string, string | number>) => dispatch(authLoggedIn(token))) .then((token: Record<string, string | number>) => dispatch(authLoggedIn(token)))
.then(({ access_token }: any) => dispatch(verifyCredentials(access_token as string, baseURL))) .then(({ access_token }: any) => dispatch(verifyCredentials(access_token as string, baseURL)))
.then((account: { id: string }) => dispatch(switchAccount(account.id))) .then((account: { id: string }) => dispatch(switchAccount(account.id)))
.then(() => localStorage.removeItem('soapbox:external:baseurl'))
.then(() => window.location.href = '/'); .then(() => window.location.href = '/');
}; };