In an iOS application using AWS Cognito.
Inside the didCompleteStepWithError(_ error: Error?)
method, I'm having trouble with the isSignedIn
property which is not immediately true after a successful login.
When I immediately check for:
userPool.currentUser?.isSignedIn // false
But if I delay the check:
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
print(userPool.currentUser?.isSignedIn) // true
})
1) Why is the isSignedIn
property not immediately true ?
2) How to deal with this if I need to do a getDetails()
in order to update the UI ? It is a problem since calling getDetails()
with isSignedIn
still false will cause the SDK to kick-start the authentication process again.
I've come across the same issue and the way that I get passed was this:
Right after signing in, when you have the username and password, in the Cognito delegate method: didCompleteStepWithError, call this method:
Code will be something like this:
for me doing this got the user status correct. Definitely not ideal but it did the job for me.