UNPKG

@aws-amplify/auth

Version:

Auth category of aws-amplify

23 lines (21 loc) • 1.16 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveTokenOrchestrator = void 0; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 const utils_1 = require("@aws-amplify/core/internals/utils"); const tokenProvider_1 = require("./tokenProvider"); /** * 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) => (0, utils_1.getContextTokenOrchestrator)(ctx?.libraryOptions?.Auth?.tokenProvider) ?? tokenProvider_1.tokenOrchestrator; exports.resolveTokenOrchestrator = resolveTokenOrchestrator; //# sourceMappingURL=contextTokenOrchestrators.js.map