UNPKG

@aws-amplify/auth

Version:

Auth category of aws-amplify

1 lines • 1.84 kB
{"version":3,"file":"handleOAuthSignOut.native.mjs","sources":["../../../../../../src/providers/cognito/utils/oauth/handleOAuthSignOut.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { completeOAuthSignOut } from './completeOAuthSignOut';\nimport { oAuthSignOutRedirect } from './oAuthSignOutRedirect';\nexport const handleOAuthSignOut = async (cognitoConfig, store, tokenOrchestrator, redirectUrl, clearCredentials) => {\n const { isOAuthSignIn, preferPrivateSession } = await store.loadOAuthSignIn();\n if (isOAuthSignIn) {\n const result = await oAuthSignOutRedirect(cognitoConfig, preferPrivateSession, redirectUrl);\n // If this was a private session, clear data and tokens regardless of what happened with logout\n // endpoint. Otherwise, only do so if the logout endpoint was succesfully visited.\n const shouldCompleteSignOut = preferPrivateSession || result?.type === 'success';\n if (shouldCompleteSignOut) {\n await completeOAuthSignOut(store, tokenOrchestrator, clearCredentials);\n }\n return result;\n }\n return completeOAuthSignOut(store, tokenOrchestrator, clearCredentials);\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,kBAAkB,GAAG,OAAO,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,KAAK;AACpH,IAAI,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,MAAM,KAAK,CAAC,eAAe,EAAE;AACjF,IAAI,IAAI,aAAa,EAAE;AACvB,QAAQ,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,aAAa,EAAE,oBAAoB,EAAE,WAAW,CAAC;AACnG;AACA;AACA,QAAQ,MAAM,qBAAqB,GAAG,oBAAoB,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS;AACxF,QAAQ,IAAI,qBAAqB,EAAE;AACnC,YAAY,MAAM,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,CAAC;AAClF,QAAQ;AACR,QAAQ,OAAO,MAAM;AACrB,IAAI;AACJ,IAAI,OAAO,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,CAAC;AAC3E;;;;"}