-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tokens are invalid, please sign-in again after call AWSMobileClient.getInstance().getTokens(callback) #873
Comments
@tvanmanh There are significant bugs in 2.13.0 (and 2.12.x) with token management if using AWSMobileClient drip in UI, and as as a result the AWSMobieClient drop in UI will not refresh tokens properly and other related issues. I was able to get it working in 2.13.1. You wrote: "I resolved it by add UserStateListener after getting SIGNED_OUT_USER_POOLS_TOKENS_INVALID i will sign in again but should I do that every time I kill app and open again ?" I do exactly that in my code taken from the sample code and this should work in 2.13.1.
where showSignIn() is calls
I hope this helps as you wait for an official response from the AWS team. |
@BillBunting Thanks a lot for your help. |
@BillBunting Thanks! It's worth noting that the So make sure to call EDIT: If anyone using flutter came over here, the flutter_cognito_plugin has integrated the workaround for this inside the |
issue a workaround for aws-amplify/aws-sdk-android#873 minor bug-fixes with exception serializer use proper callback for getUserAttributes() (in kotlin)
I'm facing a similar issue 1.- Initialize AWSMobileClient
2.- Sign in users using
3.- After a successfull sign in, close the app 3.- Open the app again
I have debugged the SDK and the issue is that I have looked another issues,and this #888 appears to be the same. It's a very serious bug, that has not been resolved in a long time, so I think that should be resolved as soon as posible. (In my case, our company can not implement SAML login without this issue solved) |
@JesusMartinAlonso Thanks for reporting the error. I will take a look at it and get back to you. r |
I am working on this issue and will have an update when the fix is released. Thank you for the patience. |
The HostedUI (CognitoAuth) object has a lifecycle that starts from showSignIn and ends at signOut. However when getTokens() is called after initialize, the hostedUI object is null. There are two objects for hostedUI (one through awsconfiguration.json and other through code). The AWSMobileClient.initialize always constructs hostedUI through awsconfiguration.json and does not construct the hostedUi object through code. We are looking into a fix where we could construct one object for hostedUI during initialize which reads off the awsconfiguration.json and is useful for getTokens to work. When showSignIn is called, the same hostedUI object will be mutated to work for a signIn operation. The signOut method should not deallocate the hostedUI object. I am working on the fix and testing for HostedUI through AWSMobileClient. |
This has been merged and will go into our next release. |
A fix has been released in version 2.15.2 of the SDK. Please upgrade and verify. |
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems. |
Still seeing this on 2.15.2, on initialize it will tell me a user is signed in "result.getUserState().equals(UserState.SIGNED_IN)", then later on when I try to getTokens() it will say "AWSMobileClient: waitForSignIn: userState:SIGNED_OUT_USER_POOLS_TOKENS_INVALID in the console". Also tested on 2.16.0, immediately after it tells me UserState.SIGNED_IN it fails on getTokens() with "SIGNED_OUT_USER_POOLS_TOKENS_INVALID". Makes no sense whatsoever. |
Getting the same issue as @rbarbish |
Getting the same issues @desokroshan for 2.15.2 |
Getting this in 2.16.2 same as @rbarbish. I'm not using HostedUI but calling signIn manually. Both initialize and getUserState() return SIGNED_IN, but a call to getTokens() immediately afterwards throws an exception: |
I also get the same error as @rbarbish. I am using the newest version (2.16.+). |
News here? |
Any update here? |
@awsmobilesdk any update pls?. this is making us put an unneccesary long solution in code |
Describe the bug
I have already signed in and then I kill app and open app again.
In my plash screen I call API AWSMobileClient.getInstance().initialize() and check the user state is "SIGNED_IN".
After that I go to next step, call my backend API which needs token using AWSMobileClient.getInstance().getTokens(new Callback()) after i call that API. I got user state is " SIGNED_OUT_USER_POOLS_TOKENS_INVALID" and This call blocked the thread forever don't return token or any error.
I know that the token will expire after 1 hour but I have already signed in. Just kill my app and open app again How can i got SIGNED_OUT_USER_POOLS_TOKENS_INVALID after call get token.
I resolved it by add UserStateListener after getting SIGNED_OUT_USER_POOLS_TOKENS_INVALID i will sign in again but should I do that every time I kill app and open again ?
To Reproduce
Code and logs
Environment Information (please complete the following information):
I'm waiting for your feedback.
Thanks
The text was updated successfully, but these errors were encountered: