@aws-amplify/auth
Version:
Auth category of aws-amplify
27 lines (25 loc) • 1.36 kB
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleOAuthSignOut = void 0;
const completeOAuthSignOut_1 = require("./completeOAuthSignOut");
const oAuthSignOutRedirect_1 = require("./oAuthSignOutRedirect");
const handleOAuthSignOut = async (cognitoConfig, store,
// No-op here as it's only used in the non-native implementation
tokenOrchestrator, redirectUrl) => {
const { isOAuthSignIn, preferPrivateSession } = await store.loadOAuthSignIn();
if (isOAuthSignIn) {
const result = await (0, oAuthSignOutRedirect_1.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 (0, completeOAuthSignOut_1.completeOAuthSignOut)(store);
}
return result;
}
return (0, completeOAuthSignOut_1.completeOAuthSignOut)(store);
};
exports.handleOAuthSignOut = handleOAuthSignOut;
//# sourceMappingURL=handleOAuthSignOut.native.js.map
;