UNPKG

aws-amplify

Version:

AWS Amplify is a JavaScript library for Frontend and mobile developers building cloud-enabled applications.

1 lines 1.91 kB
{"version":3,"file":"createUserPoolsTokenProvider.mjs","sources":["../../../../../src/adapter-core/authProvidersFactories/cognito/createUserPoolsTokenProvider.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DefaultTokenStore, TokenOrchestrator, refreshAuthTokensWithoutDedupe, } from '@aws-amplify/auth/cognito';\n/**\n * Creates an object that implements {@link TokenProvider}.\n * @param authConfig The Auth config that the credentials provider needs to function.\n * @param keyValueStorage An object that implements the {@link KeyValueStorageInterface}.\n * @returns An object that implements {@link TokenProvider}.\n */\nexport const createUserPoolsTokenProvider = (authConfig, keyValueStorage) => {\n const authTokenStore = new DefaultTokenStore();\n authTokenStore.setAuthConfig(authConfig);\n authTokenStore.setKeyValueStorage(keyValueStorage);\n const tokenOrchestrator = new TokenOrchestrator();\n tokenOrchestrator.setAuthConfig(authConfig);\n tokenOrchestrator.setAuthTokenStore(authTokenStore);\n tokenOrchestrator.setTokenRefresher(refreshAuthTokensWithoutDedupe);\n return {\n getTokens: ({ forceRefresh } = { forceRefresh: false }) => tokenOrchestrator.getTokens({ forceRefresh }),\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG,CAAC,UAAU,EAAE,eAAe,KAAK;AAC7E,IAAI,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAE;AAClD,IAAI,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC;AAC5C,IAAI,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC;AACtD,IAAI,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE;AACrD,IAAI,iBAAiB,CAAC,aAAa,CAAC,UAAU,CAAC;AAC/C,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC;AACvD,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,8BAA8B,CAAC;AACvE,IAAI,OAAO;AACX,QAAQ,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,iBAAiB,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;AAChH,KAAK;AACL;;;;"}