Closed qhanam closed 10 months ago
I'm skeptical about the "never expires" part. There might be some unintended consequences here.
Perhaps we can fetch a new Id if getCredentialsForIdentity
fails because the Id is not recognized.
question: Will we benefit from storing the identity key as part of the
CognitoIdentityClient
's class member, similar tothis.credentials
in theAuthentication
class?
Yes, but nearly as much. The credential gets accessed every time events get dispatched, while the identity gets accessed only when the credential expires.
Cognito identity Ids, which are used to allow unauthenticated users to send RUM data, can be re-used and do not expire.
This change stores identity Ids in localStorage in a similar way to how credentials are stored. Along with using the enhanced authflow, this means in most cases there will be one auth-related request instead of three.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.