@aws-amplify/auth
Version:
Auth category of aws-amplify
23 lines (21 loc) • 1.15 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.completeOAuthSignOut = void 0;
const core_1 = require("@aws-amplify/core");
const utils_1 = require("@aws-amplify/core/internals/utils");
const completeOAuthSignOut = async (store, tokenOrchestrator, clearCredentials) => {
await store.clearOAuthData();
// The orchestrator and the credential-clearing callback are resolved from the
// caller's `AmplifyContext` in `signOut` and threaded down through
// `handleOAuthSignOut`, so both target the context's own stores. This path is
// only ever reached in-process from `signOut`; OAuth sign-IN completion after
// a full-page redirect is a different flow (`completeOAuthFlow`, driven by
// `enableOAuthListener`).
tokenOrchestrator.clearTokens();
await clearCredentials();
core_1.Hub.dispatch('auth', { event: 'signedOut' }, 'Auth', utils_1.AMPLIFY_SYMBOL);
};
exports.completeOAuthSignOut = completeOAuthSignOut;
//# sourceMappingURL=completeOAuthSignOut.js.map