Just be aware that store JWT directly in the browser is not secure, you will need yo use a cookie with a HttpOnly only flag.
I know your answer is concerning the Cognito Hosted UI, but you tried to see if your web application could leverage AWS Amplify Auth? It uses Cognito and has a lot of helpers built-in and if you are using a specific framework simple ways to customize your own UI.
Remember device to suppress MFA challenge using Cognito Hosted UIasked 4 days ago
Cognito Hosted UI to Custom UIAccepted Answerasked 2 years ago
Cognito Hosted UI, using code flow and refresh with an SDK?asked a month ago
How to translate Cognito Hosted UI Forms?asked 5 months ago
Authorization code flow with custom UI and Cognitoasked 2 months ago
Authorization code flow with custom UI and CognitoAccepted Answerasked 2 years ago
Using PKCE flow with @aws-sdk/client-cognito-identity-providerasked 5 months ago
Amazon Cognito hosted UI password reset code messageAccepted Answerasked 8 months ago
Cognito Hosted UI user email verification (using valid verification code) failed (according to UI) but user is confirmed.asked 7 months ago
Cognito Authorisation Server - Is there a vulnerability when using PKCE flow?asked 8 months ago