I already solved the problem, instead of using the manual redirect windows.location.replace(cognitoHostedURI) use the await signInWithRedirect () and it will automatically redirect to cognito hosted UI with required parameters.
windows.location.replace(cognitoHostedURI)
await signInWithRedirect ()