@aws-amplify/auth
Version:
Auth category of aws-amplify
21 lines (18 loc) • 1.01 kB
JavaScript
import { getContextTokenOrchestrator } from '@aws-amplify/core/internals/utils';
import { tokenOrchestrator } from './tokenProvider.mjs';
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Resolves the write-capable token orchestrator for the given context.
*
* Returns the per-context orchestrator registered for the context's token
* provider when one exists (the `createAmplifyContext()` path), and falls back
* to the module-level singleton for the global `Amplify.configure()` path.
*
* This MUST be called at the entry point of a flow (e.g. `signInWithSRP`) so
* every step downstream — including early device-metadata reads — uses the same
* correctly configured orchestrator. Internal only.
*/
const resolveTokenOrchestrator = (ctx) => getContextTokenOrchestrator(ctx?.libraryOptions?.Auth?.tokenProvider) ?? tokenOrchestrator;
export { resolveTokenOrchestrator };
//# sourceMappingURL=contextTokenOrchestrators.mjs.map