UNPKG

@aws-amplify/auth

Version:

Auth category of aws-amplify

23 lines (20 loc) • 1.18 kB
import { completeOAuthSignOut } from './completeOAuthSignOut.mjs'; import { oAuthSignOutRedirect } from './oAuthSignOutRedirect.mjs'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 const handleOAuthSignOut = async (cognitoConfig, store, tokenOrchestrator, redirectUrl, clearCredentials) => { const { isOAuthSignIn, preferPrivateSession } = await store.loadOAuthSignIn(); if (isOAuthSignIn) { const result = await oAuthSignOutRedirect(cognitoConfig, preferPrivateSession, redirectUrl); // If this was a private session, clear data and tokens regardless of what happened with logout // endpoint. Otherwise, only do so if the logout endpoint was succesfully visited. const shouldCompleteSignOut = preferPrivateSession || result?.type === 'success'; if (shouldCompleteSignOut) { await completeOAuthSignOut(store, tokenOrchestrator, clearCredentials); } return result; } return completeOAuthSignOut(store, tokenOrchestrator, clearCredentials); }; export { handleOAuthSignOut }; //# sourceMappingURL=handleOAuthSignOut.native.mjs.map