aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.41k stars 2.12k forks source link

CognitoUserPoolsTokenProvider authTokenStore does not update keys with latest Auth config #13707

Open Unemployed opened 1 month ago

Unemployed commented 1 month ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth, storage

Backend

None

Environment information

``` # Put output below this line System: OS: Windows 10 10.0.19045 CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz Memory: 16.12 GB / 31.73 GB Binaries: Node: 18.20.3 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Chromium (127.0.2651.74) Internet Explorer: 11.0.19041.4355 npmPackages: @ant-design/charts: ^2.1.0 => 2.1.0 @aws-amplify/ui-react: ^6.1.6 => 6.1.6 @aws-amplify/ui-react-internal: undefined () @floating-ui/react-dom: ^2.1.0 => 2.1.0 (2.1.1, 0.7.2) @headlessui/react: ^2.1.2 => 2.1.2 @radix-ui/react-dialog: ^1.0.5 => 1.0.5 @radix-ui/react-tooltip: ^1.0.7 => 1.0.7 @tailwindcss/container-queries: ^0.1.1 => 0.1.1 @tailwindcss/forms: ^0.5.7 => 0.5.7 @tanstack/query-codemods: 4.24.3 @tanstack/react-query: ^5.36.2 => 5.36.2 @types/react: ^18.2.55 => 18.2.55 @types/react-dom: ^18.2.19 => 18.2.19 @types/react-tag-input: ^6.6.6 => 6.6.6 @typescript-eslint/eslint-plugin: ^6.21.0 => 6.21.0 @typescript-eslint/parser: ^6.21.0 => 6.21.0 @vitejs/plugin-react: ^4.2.1 => 4.2.1 autoprefixer: ^10.4.17 => 10.4.17 aws-amplify: ^6.0.17 => 6.0.17 aws-amplify/adapter-core: undefined () aws-amplify/analytics: undefined () aws-amplify/analytics/kinesis: undefined () aws-amplify/analytics/kinesis-firehose: undefined () aws-amplify/analytics/personalize: undefined () aws-amplify/analytics/pinpoint: undefined () aws-amplify/api: undefined () aws-amplify/api/server: undefined () aws-amplify/auth: undefined () aws-amplify/auth/cognito: undefined () aws-amplify/auth/cognito/server: undefined () aws-amplify/auth/enable-oauth-listener: undefined () aws-amplify/auth/server: undefined () aws-amplify/datastore: undefined () aws-amplify/in-app-messaging: undefined () aws-amplify/in-app-messaging/pinpoint: undefined () aws-amplify/push-notifications: undefined () aws-amplify/push-notifications/pinpoint: undefined () aws-amplify/storage: undefined () aws-amplify/storage/s3: undefined () aws-amplify/storage/s3/server: undefined () aws-amplify/storage/server: undefined () aws-amplify/utils: undefined () class-variance-authority: ^0.7.0 => 0.7.0 classnames: ^2.5.1 => 2.5.1 (2.3.3) clsx: ^2.1.0 => 2.1.0 (2.1.1, 2.0.0) country-flag-icons: ^1.5.9 => 1.5.9 country-flag-icons/commonjs: undefined () country-flag-icons/react/1x1: undefined () country-flag-icons/react/1x1/AC: undefined () country-flag-icons/react/1x1/AD: undefined () country-flag-icons/react/1x1/AE: undefined () country-flag-icons/react/1x1/AF: undefined () country-flag-icons/react/1x1/AG: undefined () country-flag-icons/react/1x1/AI: undefined () country-flag-icons/react/1x1/AL: undefined () country-flag-icons/react/1x1/AM: undefined () country-flag-icons/react/1x1/AO: undefined () country-flag-icons/react/1x1/AQ: undefined () country-flag-icons/react/1x1/AR: undefined () country-flag-icons/react/1x1/AS: undefined () country-flag-icons/react/1x1/AT: undefined () country-flag-icons/react/1x1/AU: undefined () country-flag-icons/react/1x1/AW: undefined () country-flag-icons/react/1x1/AX: undefined () country-flag-icons/react/1x1/AZ: undefined () country-flag-icons/react/1x1/BA: undefined () country-flag-icons/react/1x1/BB: undefined () country-flag-icons/react/1x1/BD: undefined () country-flag-icons/react/1x1/BE: undefined () country-flag-icons/react/1x1/BF: undefined () country-flag-icons/react/1x1/BG: undefined () country-flag-icons/react/1x1/BH: undefined () country-flag-icons/react/1x1/BI: undefined () country-flag-icons/react/1x1/BJ: undefined () country-flag-icons/react/1x1/BL: undefined () country-flag-icons/react/1x1/BM: undefined () country-flag-icons/react/1x1/BN: undefined () country-flag-icons/react/1x1/BO: undefined () country-flag-icons/react/1x1/BQ: undefined () country-flag-icons/react/1x1/BR: undefined () country-flag-icons/react/1x1/BS: undefined () country-flag-icons/react/1x1/BT: undefined () country-flag-icons/react/1x1/BV: undefined () country-flag-icons/react/1x1/BW: undefined () country-flag-icons/react/1x1/BY: undefined () country-flag-icons/react/1x1/BZ: undefined () country-flag-icons/react/1x1/CA: undefined () country-flag-icons/react/1x1/CC: undefined () country-flag-icons/react/1x1/CD: undefined () country-flag-icons/react/1x1/CF: undefined () country-flag-icons/react/1x1/CG: undefined () country-flag-icons/react/1x1/CH: undefined () country-flag-icons/react/1x1/CI: undefined () country-flag-icons/react/1x1/CK: undefined () country-flag-icons/react/1x1/CL: undefined () country-flag-icons/react/1x1/CM: undefined () country-flag-icons/react/1x1/CN: undefined () country-flag-icons/react/1x1/CO: undefined () country-flag-icons/react/1x1/CR: undefined () country-flag-icons/react/1x1/CU: undefined () country-flag-icons/react/1x1/CV: undefined () country-flag-icons/react/1x1/CW: undefined () country-flag-icons/react/1x1/CX: undefined () country-flag-icons/react/1x1/CY: undefined () country-flag-icons/react/1x1/CZ: undefined () country-flag-icons/react/1x1/DE: undefined () country-flag-icons/react/1x1/DJ: undefined () country-flag-icons/react/1x1/DK: undefined () country-flag-icons/react/1x1/DM: undefined () country-flag-icons/react/1x1/DO: undefined () country-flag-icons/react/1x1/DZ: undefined () country-flag-icons/react/1x1/EC: undefined () country-flag-icons/react/1x1/EE: undefined () country-flag-icons/react/1x1/EG: undefined () country-flag-icons/react/1x1/EH: undefined () country-flag-icons/react/1x1/ER: undefined () country-flag-icons/react/1x1/ES: undefined () country-flag-icons/react/1x1/ET: undefined () country-flag-icons/react/1x1/EU: undefined () country-flag-icons/react/1x1/FI: undefined () country-flag-icons/react/1x1/FJ: undefined () country-flag-icons/react/1x1/FK: undefined () country-flag-icons/react/1x1/FM: undefined () country-flag-icons/react/1x1/FO: undefined () country-flag-icons/react/1x1/FR: undefined () country-flag-icons/react/1x1/GA: undefined () country-flag-icons/react/1x1/GB: undefined () country-flag-icons/react/1x1/GD: undefined () country-flag-icons/react/1x1/GE: undefined () country-flag-icons/react/1x1/GF: undefined () country-flag-icons/react/1x1/GG: undefined () country-flag-icons/react/1x1/GH: undefined () country-flag-icons/react/1x1/GI: undefined () country-flag-icons/react/1x1/GL: undefined () country-flag-icons/react/1x1/GM: undefined () country-flag-icons/react/1x1/GN: undefined () country-flag-icons/react/1x1/GP: undefined () country-flag-icons/react/1x1/GQ: undefined () country-flag-icons/react/1x1/GR: undefined () country-flag-icons/react/1x1/GS: undefined () country-flag-icons/react/1x1/GT: undefined () country-flag-icons/react/1x1/GU: undefined () country-flag-icons/react/1x1/GW: undefined () country-flag-icons/react/1x1/GY: undefined () country-flag-icons/react/1x1/HK: undefined () country-flag-icons/react/1x1/HM: undefined () country-flag-icons/react/1x1/HN: undefined () country-flag-icons/react/1x1/HR: undefined () country-flag-icons/react/1x1/HT: undefined () country-flag-icons/react/1x1/HU: undefined () country-flag-icons/react/1x1/IC: undefined () country-flag-icons/react/1x1/ID: undefined () country-flag-icons/react/1x1/IE: undefined () country-flag-icons/react/1x1/IL: undefined () country-flag-icons/react/1x1/IM: undefined () country-flag-icons/react/1x1/IN: undefined () country-flag-icons/react/1x1/IO: undefined () country-flag-icons/react/1x1/IQ: undefined () country-flag-icons/react/1x1/IR: undefined () country-flag-icons/react/1x1/IS: undefined () country-flag-icons/react/1x1/IT: undefined () country-flag-icons/react/1x1/JE: undefined () country-flag-icons/react/1x1/JM: undefined () country-flag-icons/react/1x1/JO: undefined () country-flag-icons/react/1x1/JP: undefined () country-flag-icons/react/1x1/KE: undefined () country-flag-icons/react/1x1/KG: undefined () country-flag-icons/react/1x1/KH: undefined () country-flag-icons/react/1x1/KI: undefined () country-flag-icons/react/1x1/KM: undefined () country-flag-icons/react/1x1/KN: undefined () country-flag-icons/react/1x1/KP: undefined () country-flag-icons/react/1x1/KR: undefined () country-flag-icons/react/1x1/KW: undefined () country-flag-icons/react/1x1/KY: undefined () country-flag-icons/react/1x1/KZ: undefined () country-flag-icons/react/1x1/LA: undefined () country-flag-icons/react/1x1/LB: undefined () country-flag-icons/react/1x1/LC: undefined () country-flag-icons/react/1x1/LI: undefined () country-flag-icons/react/1x1/LK: undefined () country-flag-icons/react/1x1/LR: undefined () country-flag-icons/react/1x1/LS: undefined () country-flag-icons/react/1x1/LT: undefined () country-flag-icons/react/1x1/LU: undefined () country-flag-icons/react/1x1/LV: undefined () country-flag-icons/react/1x1/LY: undefined () country-flag-icons/react/1x1/MA: undefined () country-flag-icons/react/1x1/MC: undefined () country-flag-icons/react/1x1/MD: undefined () country-flag-icons/react/1x1/ME: undefined () country-flag-icons/react/1x1/MF: undefined () country-flag-icons/react/1x1/MG: undefined () country-flag-icons/react/1x1/MH: undefined () country-flag-icons/react/1x1/MK: undefined () country-flag-icons/react/1x1/ML: undefined () country-flag-icons/react/1x1/MM: undefined () country-flag-icons/react/1x1/MN: undefined () country-flag-icons/react/1x1/MO: undefined () country-flag-icons/react/1x1/MP: undefined () country-flag-icons/react/1x1/MQ: undefined () country-flag-icons/react/1x1/MR: undefined () country-flag-icons/react/1x1/MS: undefined () country-flag-icons/react/1x1/MT: undefined () country-flag-icons/react/1x1/MU: undefined () country-flag-icons/react/1x1/MV: undefined () country-flag-icons/react/1x1/MW: undefined () country-flag-icons/react/1x1/MX: undefined () country-flag-icons/react/1x1/MY: undefined () country-flag-icons/react/1x1/MZ: undefined () country-flag-icons/react/1x1/NA: undefined () country-flag-icons/react/1x1/NC: undefined () country-flag-icons/react/1x1/NE: undefined () country-flag-icons/react/1x1/NF: undefined () country-flag-icons/react/1x1/NG: undefined () country-flag-icons/react/1x1/NI: undefined () country-flag-icons/react/1x1/NL: undefined () country-flag-icons/react/1x1/NO: undefined () country-flag-icons/react/1x1/NP: undefined () country-flag-icons/react/1x1/NR: undefined () country-flag-icons/react/1x1/NU: undefined () country-flag-icons/react/1x1/NZ: undefined () country-flag-icons/react/1x1/OM: undefined () country-flag-icons/react/1x1/PA: undefined () country-flag-icons/react/1x1/PE: undefined () country-flag-icons/react/1x1/PF: undefined () country-flag-icons/react/1x1/PG: undefined () country-flag-icons/react/1x1/PH: undefined () country-flag-icons/react/1x1/PK: undefined () country-flag-icons/react/1x1/PL: undefined () country-flag-icons/react/1x1/PM: undefined () country-flag-icons/react/1x1/PN: undefined () country-flag-icons/react/1x1/PR: undefined () country-flag-icons/react/1x1/PS: undefined () country-flag-icons/react/1x1/PT: undefined () country-flag-icons/react/1x1/PW: undefined () country-flag-icons/react/1x1/PY: undefined () country-flag-icons/react/1x1/QA: undefined () country-flag-icons/react/1x1/RE: undefined () country-flag-icons/react/1x1/RO: undefined () country-flag-icons/react/1x1/RS: undefined () country-flag-icons/react/1x1/RU: undefined () country-flag-icons/react/1x1/RW: undefined () country-flag-icons/react/1x1/SA: undefined () country-flag-icons/react/1x1/SB: undefined () country-flag-icons/react/1x1/SC: undefined () country-flag-icons/react/1x1/SD: undefined () country-flag-icons/react/1x1/SE: undefined () country-flag-icons/react/1x1/SG: undefined () country-flag-icons/react/1x1/SH: undefined () country-flag-icons/react/1x1/SI: undefined () country-flag-icons/react/1x1/SJ: undefined () country-flag-icons/react/1x1/SK: undefined () country-flag-icons/react/1x1/SL: undefined () country-flag-icons/react/1x1/SM: undefined () country-flag-icons/react/1x1/SN: undefined () country-flag-icons/react/1x1/SO: undefined () country-flag-icons/react/1x1/SR: undefined () country-flag-icons/react/1x1/SS: undefined () country-flag-icons/react/1x1/ST: undefined () country-flag-icons/react/1x1/SV: undefined () country-flag-icons/react/1x1/SX: undefined () country-flag-icons/react/1x1/SY: undefined () country-flag-icons/react/1x1/SZ: undefined () country-flag-icons/react/1x1/TA: undefined () country-flag-icons/react/1x1/TC: undefined () country-flag-icons/react/1x1/TD: undefined () country-flag-icons/react/1x1/TF: undefined () country-flag-icons/react/1x1/TG: undefined () country-flag-icons/react/1x1/TH: undefined () country-flag-icons/react/1x1/TJ: undefined () country-flag-icons/react/1x1/TK: undefined () country-flag-icons/react/1x1/TL: undefined () country-flag-icons/react/1x1/TM: undefined () country-flag-icons/react/1x1/TN: undefined () country-flag-icons/react/1x1/TO: undefined () country-flag-icons/react/1x1/TR: undefined () country-flag-icons/react/1x1/TT: undefined () country-flag-icons/react/1x1/TV: undefined () country-flag-icons/react/1x1/TW: undefined () country-flag-icons/react/1x1/TZ: undefined () country-flag-icons/react/1x1/UA: undefined () country-flag-icons/react/1x1/UG: undefined () country-flag-icons/react/1x1/UM: undefined () country-flag-icons/react/1x1/US: undefined () country-flag-icons/react/1x1/UY: undefined () country-flag-icons/react/1x1/UZ: undefined () country-flag-icons/react/1x1/VA: undefined () country-flag-icons/react/1x1/VC: undefined () country-flag-icons/react/1x1/VE: undefined () country-flag-icons/react/1x1/VG: undefined () country-flag-icons/react/1x1/VI: undefined () country-flag-icons/react/1x1/VN: undefined () country-flag-icons/react/1x1/VU: undefined () country-flag-icons/react/1x1/WF: undefined () country-flag-icons/react/1x1/WS: undefined () country-flag-icons/react/1x1/XK: undefined () country-flag-icons/react/1x1/YE: undefined () country-flag-icons/react/1x1/YT: undefined () country-flag-icons/react/1x1/ZA: undefined () country-flag-icons/react/1x1/ZM: undefined () country-flag-icons/react/1x1/ZW: undefined () country-flag-icons/react/3x2: undefined () country-flag-icons/react/3x2/AC: undefined () country-flag-icons/react/3x2/AD: undefined () country-flag-icons/react/3x2/AE: undefined () country-flag-icons/react/3x2/AF: undefined () country-flag-icons/react/3x2/AG: undefined () country-flag-icons/react/3x2/AI: undefined () country-flag-icons/react/3x2/AL: undefined () country-flag-icons/react/3x2/AM: undefined () country-flag-icons/react/3x2/AO: undefined () country-flag-icons/react/3x2/AQ: undefined () country-flag-icons/react/3x2/AR: undefined () country-flag-icons/react/3x2/AS: undefined () country-flag-icons/react/3x2/AT: undefined () country-flag-icons/react/3x2/AU: undefined () country-flag-icons/react/3x2/AW: undefined () country-flag-icons/react/3x2/AX: undefined () country-flag-icons/react/3x2/AZ: undefined () country-flag-icons/react/3x2/BA: undefined () country-flag-icons/react/3x2/BB: undefined () country-flag-icons/react/3x2/BD: undefined () country-flag-icons/react/3x2/BE: undefined () country-flag-icons/react/3x2/BF: undefined () country-flag-icons/react/3x2/BG: undefined () country-flag-icons/react/3x2/BH: undefined () country-flag-icons/react/3x2/BI: undefined () country-flag-icons/react/3x2/BJ: undefined () country-flag-icons/react/3x2/BL: undefined () country-flag-icons/react/3x2/BM: undefined () country-flag-icons/react/3x2/BN: undefined () country-flag-icons/react/3x2/BO: undefined () country-flag-icons/react/3x2/BQ: undefined () country-flag-icons/react/3x2/BR: undefined () country-flag-icons/react/3x2/BS: undefined () country-flag-icons/react/3x2/BT: undefined () country-flag-icons/react/3x2/BV: undefined () country-flag-icons/react/3x2/BW: undefined () country-flag-icons/react/3x2/BY: undefined () country-flag-icons/react/3x2/BZ: undefined () country-flag-icons/react/3x2/CA: undefined () country-flag-icons/react/3x2/CC: undefined () country-flag-icons/react/3x2/CD: undefined () country-flag-icons/react/3x2/CF: undefined () country-flag-icons/react/3x2/CG: undefined () country-flag-icons/react/3x2/CH: undefined () country-flag-icons/react/3x2/CI: undefined () country-flag-icons/react/3x2/CK: undefined () country-flag-icons/react/3x2/CL: undefined () country-flag-icons/react/3x2/CM: undefined () country-flag-icons/react/3x2/CN: undefined () country-flag-icons/react/3x2/CO: undefined () country-flag-icons/react/3x2/CR: undefined () country-flag-icons/react/3x2/CU: undefined () country-flag-icons/react/3x2/CV: undefined () country-flag-icons/react/3x2/CW: undefined () country-flag-icons/react/3x2/CX: undefined () country-flag-icons/react/3x2/CY: undefined () country-flag-icons/react/3x2/CZ: undefined () country-flag-icons/react/3x2/DE: undefined () country-flag-icons/react/3x2/DJ: undefined () country-flag-icons/react/3x2/DK: undefined () country-flag-icons/react/3x2/DM: undefined () country-flag-icons/react/3x2/DO: undefined () country-flag-icons/react/3x2/DZ: undefined () country-flag-icons/react/3x2/EC: undefined () country-flag-icons/react/3x2/EE: undefined () country-flag-icons/react/3x2/EG: undefined () country-flag-icons/react/3x2/EH: undefined () country-flag-icons/react/3x2/ER: undefined () country-flag-icons/react/3x2/ES: undefined () country-flag-icons/react/3x2/ET: undefined () country-flag-icons/react/3x2/EU: undefined () country-flag-icons/react/3x2/FI: undefined () country-flag-icons/react/3x2/FJ: undefined () country-flag-icons/react/3x2/FK: undefined () country-flag-icons/react/3x2/FM: undefined () country-flag-icons/react/3x2/FO: undefined () country-flag-icons/react/3x2/FR: undefined () country-flag-icons/react/3x2/GA: undefined () country-flag-icons/react/3x2/GB: undefined () country-flag-icons/react/3x2/GD: undefined () country-flag-icons/react/3x2/GE: undefined () country-flag-icons/react/3x2/GF: undefined () country-flag-icons/react/3x2/GG: undefined () country-flag-icons/react/3x2/GH: undefined () country-flag-icons/react/3x2/GI: undefined () country-flag-icons/react/3x2/GL: undefined () country-flag-icons/react/3x2/GM: undefined () country-flag-icons/react/3x2/GN: undefined () country-flag-icons/react/3x2/GP: undefined () country-flag-icons/react/3x2/GQ: undefined () country-flag-icons/react/3x2/GR: undefined () country-flag-icons/react/3x2/GS: undefined () country-flag-icons/react/3x2/GT: undefined () country-flag-icons/react/3x2/GU: undefined () country-flag-icons/react/3x2/GW: undefined () country-flag-icons/react/3x2/GY: undefined () country-flag-icons/react/3x2/HK: undefined () country-flag-icons/react/3x2/HM: undefined () country-flag-icons/react/3x2/HN: undefined () country-flag-icons/react/3x2/HR: undefined () country-flag-icons/react/3x2/HT: undefined () country-flag-icons/react/3x2/HU: undefined () country-flag-icons/react/3x2/IC: undefined () country-flag-icons/react/3x2/ID: undefined () country-flag-icons/react/3x2/IE: undefined () country-flag-icons/react/3x2/IL: undefined () country-flag-icons/react/3x2/IM: undefined () country-flag-icons/react/3x2/IN: undefined () country-flag-icons/react/3x2/IO: undefined () country-flag-icons/react/3x2/IQ: undefined () country-flag-icons/react/3x2/IR: undefined () country-flag-icons/react/3x2/IS: undefined () country-flag-icons/react/3x2/IT: undefined () country-flag-icons/react/3x2/JE: undefined () country-flag-icons/react/3x2/JM: undefined () country-flag-icons/react/3x2/JO: undefined () country-flag-icons/react/3x2/JP: undefined () country-flag-icons/react/3x2/KE: undefined () country-flag-icons/react/3x2/KG: undefined () country-flag-icons/react/3x2/KH: undefined () country-flag-icons/react/3x2/KI: undefined () country-flag-icons/react/3x2/KM: undefined () country-flag-icons/react/3x2/KN: undefined () country-flag-icons/react/3x2/KP: undefined () country-flag-icons/react/3x2/KR: undefined () country-flag-icons/react/3x2/KW: undefined () country-flag-icons/react/3x2/KY: undefined () country-flag-icons/react/3x2/KZ: undefined () country-flag-icons/react/3x2/LA: undefined () country-flag-icons/react/3x2/LB: undefined () country-flag-icons/react/3x2/LC: undefined () country-flag-icons/react/3x2/LI: undefined () country-flag-icons/react/3x2/LK: undefined () country-flag-icons/react/3x2/LR: undefined () country-flag-icons/react/3x2/LS: undefined () country-flag-icons/react/3x2/LT: undefined () country-flag-icons/react/3x2/LU: undefined () country-flag-icons/react/3x2/LV: undefined () country-flag-icons/react/3x2/LY: undefined () country-flag-icons/react/3x2/MA: undefined () country-flag-icons/react/3x2/MC: undefined () country-flag-icons/react/3x2/MD: undefined () country-flag-icons/react/3x2/ME: undefined () country-flag-icons/react/3x2/MF: undefined () country-flag-icons/react/3x2/MG: undefined () country-flag-icons/react/3x2/MH: undefined () country-flag-icons/react/3x2/MK: undefined () country-flag-icons/react/3x2/ML: undefined () country-flag-icons/react/3x2/MM: undefined () country-flag-icons/react/3x2/MN: undefined () country-flag-icons/react/3x2/MO: undefined () country-flag-icons/react/3x2/MP: undefined () country-flag-icons/react/3x2/MQ: undefined () country-flag-icons/react/3x2/MR: undefined () country-flag-icons/react/3x2/MS: undefined () country-flag-icons/react/3x2/MT: undefined () country-flag-icons/react/3x2/MU: undefined () country-flag-icons/react/3x2/MV: undefined () country-flag-icons/react/3x2/MW: undefined () country-flag-icons/react/3x2/MX: undefined () country-flag-icons/react/3x2/MY: undefined () country-flag-icons/react/3x2/MZ: undefined () country-flag-icons/react/3x2/NA: undefined () country-flag-icons/react/3x2/NC: undefined () country-flag-icons/react/3x2/NE: undefined () country-flag-icons/react/3x2/NF: undefined () country-flag-icons/react/3x2/NG: undefined () country-flag-icons/react/3x2/NI: undefined () country-flag-icons/react/3x2/NL: undefined () country-flag-icons/react/3x2/NO: undefined () country-flag-icons/react/3x2/NP: undefined () country-flag-icons/react/3x2/NR: undefined () country-flag-icons/react/3x2/NU: undefined () country-flag-icons/react/3x2/NZ: undefined () country-flag-icons/react/3x2/OM: undefined () country-flag-icons/react/3x2/PA: undefined () country-flag-icons/react/3x2/PE: undefined () country-flag-icons/react/3x2/PF: undefined () country-flag-icons/react/3x2/PG: undefined () country-flag-icons/react/3x2/PH: undefined () country-flag-icons/react/3x2/PK: undefined () country-flag-icons/react/3x2/PL: undefined () country-flag-icons/react/3x2/PM: undefined () country-flag-icons/react/3x2/PN: undefined () country-flag-icons/react/3x2/PR: undefined () country-flag-icons/react/3x2/PS: undefined () country-flag-icons/react/3x2/PT: undefined () country-flag-icons/react/3x2/PW: undefined () country-flag-icons/react/3x2/PY: undefined () country-flag-icons/react/3x2/QA: undefined () country-flag-icons/react/3x2/RE: undefined () country-flag-icons/react/3x2/RO: undefined () country-flag-icons/react/3x2/RS: undefined () country-flag-icons/react/3x2/RU: undefined () country-flag-icons/react/3x2/RW: undefined () country-flag-icons/react/3x2/SA: undefined () country-flag-icons/react/3x2/SB: undefined () country-flag-icons/react/3x2/SC: undefined () country-flag-icons/react/3x2/SD: undefined () country-flag-icons/react/3x2/SE: undefined () country-flag-icons/react/3x2/SG: undefined () country-flag-icons/react/3x2/SH: undefined () country-flag-icons/react/3x2/SI: undefined () country-flag-icons/react/3x2/SJ: undefined () country-flag-icons/react/3x2/SK: undefined () country-flag-icons/react/3x2/SL: undefined () country-flag-icons/react/3x2/SM: undefined () country-flag-icons/react/3x2/SN: undefined () country-flag-icons/react/3x2/SO: undefined () country-flag-icons/react/3x2/SR: undefined () country-flag-icons/react/3x2/SS: undefined () country-flag-icons/react/3x2/ST: undefined () country-flag-icons/react/3x2/SV: undefined () country-flag-icons/react/3x2/SX: undefined () country-flag-icons/react/3x2/SY: undefined () country-flag-icons/react/3x2/SZ: undefined () country-flag-icons/react/3x2/TA: undefined () country-flag-icons/react/3x2/TC: undefined () country-flag-icons/react/3x2/TD: undefined () country-flag-icons/react/3x2/TF: undefined () country-flag-icons/react/3x2/TG: undefined () country-flag-icons/react/3x2/TH: undefined () country-flag-icons/react/3x2/TJ: undefined () country-flag-icons/react/3x2/TK: undefined () country-flag-icons/react/3x2/TL: undefined () country-flag-icons/react/3x2/TM: undefined () country-flag-icons/react/3x2/TN: undefined () country-flag-icons/react/3x2/TO: undefined () country-flag-icons/react/3x2/TR: undefined () country-flag-icons/react/3x2/TT: undefined () country-flag-icons/react/3x2/TV: undefined () country-flag-icons/react/3x2/TW: undefined () country-flag-icons/react/3x2/TZ: undefined () country-flag-icons/react/3x2/UA: undefined () country-flag-icons/react/3x2/UG: undefined () country-flag-icons/react/3x2/UM: undefined () country-flag-icons/react/3x2/US: undefined () country-flag-icons/react/3x2/UY: undefined () country-flag-icons/react/3x2/UZ: undefined () country-flag-icons/react/3x2/VA: undefined () country-flag-icons/react/3x2/VC: undefined () country-flag-icons/react/3x2/VE: undefined () country-flag-icons/react/3x2/VG: undefined () country-flag-icons/react/3x2/VI: undefined () country-flag-icons/react/3x2/VN: undefined () country-flag-icons/react/3x2/VU: undefined () country-flag-icons/react/3x2/WF: undefined () country-flag-icons/react/3x2/WS: undefined () country-flag-icons/react/3x2/XK: undefined () country-flag-icons/react/3x2/YE: undefined () country-flag-icons/react/3x2/YT: undefined () country-flag-icons/react/3x2/ZA: undefined () country-flag-icons/react/3x2/ZM: undefined () country-flag-icons/react/3x2/ZW: undefined () country-flag-icons/string/1x1: undefined () country-flag-icons/string/3x2: undefined () country-flag-icons/unicode: undefined () eslint: ^8.56.0 => 8.56.0 eslint-plugin-react-hooks: ^4.6.0 => 4.6.0 eslint-plugin-react-refresh: ^0.4.5 => 0.4.5 idb-keyval: ^6.2.1 => 6.2.1 install-peers: ^1.0.4 => 1.0.4 lucide-react: ^0.341.0 => 0.341.0 postcss: ^8.4.35 => 8.4.35 prettier: 3.2.5 => 3.2.5 prettier-plugin-tailwindcss: ^0.6.0 => 0.6.0 react: ^18.2.0 => 18.2.0 react-dnd: ^16.0.1 => 16.0.1 react-dnd-html5-backend: ^16.0.1 => 16.0.1 react-dom: ^18.2.0 => 18.2.0 react-router-dom: ^6.22.0 => 6.22.0 react-select: ^5.8.0 => 5.8.0 react-tag-input: ^6.9.0 => 6.9.0 react-toastify: ^10.0.5 => 10.0.5 tailwind-merge: ^2.2.1 => 2.2.1 tailwindcss: ^3.4.1 => 3.4.1 tailwindcss-animate: ^1.0.7 => 1.0.7 typescript: ^5.2.2 => 5.3.3 vaul: ^0.9.0 => 0.9.0 vite: ^5.1.0 => 5.1.1 vite-tsconfig-paths: ^4.3.1 => 4.3.1 zustand: ^4.5.0 => 4.5.0 ```

Describe the bug

cognitoUserPoolsTokenProvider does not respect Cognito changes to Amplify.configure(...) after initial load, and writes to local storage using outdated config keys. Requires a call to cognitoUserPoolsTokenProvider.authTokenStore.setAuthConfig to update the config.

From: import { cognitoUserPoolsTokenProvider } from "aws-amplify/auth/cognito";

Expected behavior

I expected <Authenticator> UI component would always persist token details using the last set amplify config, even if the component is re-rendered.

Reproduction steps

Using SPA, page is not refreshed until step 7:

  1. Amplify.configure(config1);
  2. Log in using <Authenticator> component
  3. Call signOut from useAuthenticator((x) => [x.signOut]);
  4. Switch to second pool, by clicking radio button which calls Amplify.configure(config2);
  5. Log in using <Authenticator> UI component
  6. Local storage persisted sign in details as CognitoIdentityServiceProvider.OLD_CLIENT_ID.x.clockDrift...
  7. Refresh page, user is deemed unauthorized

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

Config1:

 Auth: {
      Cognito: {
        userPoolId: "ap-southeast-2_one",
        userPoolClientId: "client1",
      },

Config2:

 Auth: {
      Cognito: {
        userPoolId: "ap-southeast-2_two",
        userPoolClientId: "client2",
      },

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

image

Update config when clicking either radio button:

updateConfig: (newConfig) => {
  Amplify.configure(newConfig);
  // Workaround to fix issue:
  cognitoUserPoolsTokenProvider.authTokenStore.setAuthConfig(newConfig.Auth);
},

Auth flow is USER_SRP_AUTH for both configs.

cwomack commented 4 weeks ago

Hello, @Unemployed and thank you for opening this issue. I'm marking this as a feature request at this time due to the cognitoUserPoolsTokenProvider being a singleton that is not connected to Amplify.configure(). This means that manual updates are needed every time when you're looking to change your config for Auth. The way you're currently working around this by calling Amplify.configure again as needed to update the auth config used by the token provider is the only way to do this right now.

I'll review this with the team to see if there's a way we can resolve this and follow up with any additional questions we may have.

cwomack commented 4 weeks ago

@Unemployed, I think we'll actually flip the labeling of this issue to a bug due to the exposed single for cognitoUserPoolsTokenProvider being a signleton that cannot reflect changes to new config calls. If this was fixed, would this address the issue for you?

Unemployed commented 4 weeks ago

Thanks @cwomack, yes if cognitoUserPoolsTokenProvider was able to update after Amplify.configure changes that should fix the issue.

cwomack commented 3 weeks ago

@Unemployed, appreciate the confirmation. We'll keep this issue updated with any further questions we have or progress as we make it.

mariasemionova commented 2 weeks ago

I am sorry if it is out of scope of this thread. But I didn't find anything more related to my question: Is there a way to use a single "aws-amplify/auth" configuration across multiple microfrontend apps?

I have a monorepo (Turborepo managed with pnpm) where all authentication logic is centralized in the main app. The other apps function as subpaths of the main app, facilitated by Next.js rewrites (NextJS 14 App Router). However, when I navigate to a subapp, it seems that the "aws-amplify/auth" context is lost.

I'm trying to run Amplify.configure(amplify_outputs) with the same configuration in all subapps as early as possible (root layout). I was hoping this would allow it to recognize session data from Cognito cookies, which are accessible to the subapps.

However, when I call "fetchAuthSession()" from subapp, it returns no data, indicating that the user is unauthenticated. While same call from the main app will return session data.

Does anyone know of an example of a similar setup or have suggestions on how to resolve this?

P.S. I also update Amplify.config after initialisation: each time before login. My users are located in different user pools. I check by email which UserPoll to use. So I also encountered same issue that Cookies ClientID wasn't updated.

cwomack commented 2 weeks ago

@mariasemionova, it sounds like you're also commenting on this thread because you're trying to use multiple user pools and having issues with this when calling Amplify.configure(). Can you help me understand the use case behind why you're needing multiple user pools?

Also, there may be some value in seeing the convo this related issue and comment of #12986.