I am working on login related performance issues with an application. The issue I'm investigating at the moment is that AWS Cognito makes multiple round trips in order to authenticate a user.
After calling authenticateUser (as seen here), Cognito then makes a minimum of 5 round trips before authentication finishes and the onSuccess callback fires (I said 'minimum' b/c it will make more if the Cognito userpool has device memorization enabled). This takes up considerable time.
Additionally, there is processing between the requests (Cognito code), which also appear to take noticeable amounts of time. Here is a screenshot of the requests with the device memorization enabled:
The red box outlines the Cognito requests that occur during authentication. Notice the vertical black bars. I added those to show the gaps between the requests. These are due to Cognito library code processing in the browser after each request:
These XHR Ready State Change function calls are the 'gap' between each Cognito call, and are quite lengthy. They result in console warnings:
11:15:29.124 zone.js:1438 [Violation] 'readystatechange' handler took 753ms
11:15:29.933 zone.js:1438 [Violation] 'readystatechange' handler took 611ms
11:15:30.806 zone.js:1438 [Violation] 'readystatechange' handler took 793ms
My question is whether or not anything can be done about this? Is this a common experience among other Cognito users? Is it perhaps an Angular-Cognito mashup due to zones that's causing it? Please let me know if more information is needed.

