Closed salvatore373 closed 4 years ago
Have you checked that your getCredentials
isn't called twice?
This part of your code seems correct.
Yes, @furaiev, you were right. I called getCredentials()
twice, one time immediately after the other. But why doesn't this function just return the user's credentials both the times?
@salvatore373 what do you expect calling getAwsCredentials
?
In my opinion, whenever you call getAwsCredentials
it should return the credentials when they're available, and when they aren't it should return a null value or throw an exception. I think that this method should never return an object with null properties.
getAwsCredentials
is a VOID method. It doesn't return data.
After authenticating and using the Cognito credentials for a little time (along with other AWS services), when I try to retrieve them after an app hot restart, I get the following error and I'm no more able to use them to access the other AWS services.
Failed assertion: line 27 pos 12: 'accessKey != null': is not true.
However, I noticed that the
getAwsCredentials()
method gets called twice: while the first time it returns null keys and tokens, the second time they are correct. If I hot reload after the hot restart that gets me null keys, I get valid keys and tokens at the first call. I am pretty new to this package, so I might be making mistakes in my code, even though it is very basic. Here it is:Am I wrong with my code or is there an error in the package?