-
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
Missing required parameter REFRESH_TOKEN #940
Comments
@eax32 Thanks for reporting this. Can you please share some relevant code snippet. Does this happen on sign-in or signups after reinstalling? |
@desokroshan Thanks for answer. So, we use AWSMobileClient: private void _signIn(String username, String password, final boolean sendVerificationCode, final AuthProcessHandler authProcessHandler) {
mobileClient().signIn(username, password, null, new Callback<SignInResult>() {
@Override
public void onResult(SignInResult result) {
processSignInResult(result, sendVerificationCode, authProcessHandler);
}
@Override
public void onError(Exception e) {
final MPSyncError error = getErrorFromException(e);
mExecutionContext.onMain(new Runnable() {
@Override
public void run() {
authProcessHandler.onError(error);
}
});
doFailedAuth();
}
});
} So, I think (after exploring our app logs) it happend on sign-in after reinstall app. |
@desokroshan Also, have a question: in previous versions of our app we use low level api (something like AWSMobileClient uses) - and after app upgrade to AWSMobileClient, mobileClient.initialize allways returns that there is no logined user, so we ask user to relogin, and next all worked well. It's normal behaviour? |
@desokroshan @kvasukib Hello, do you have any updates/info for me? |
@eax32 Sorry for the delayed response. |
@kvasukib so, this bug reproduces on android 9.0 with auto backups enabled. User login, next delete the app, and next reinstall again - so, we have "Missing required parameter REFRESH_TOKEN". Also we fix this issue by cleaning shared preferences before signin. So, you can integrate in to upstream something like this or more elegant. |
@desokroshan I developed this issue recently on my Pixel (original) and found the following:
So, for some reason, this account whose deletion and recreation I was working testing on a particular device just doesn't work any more, even if I uninstall the app and restart. This leads me to believe that there is a server side component to this, for some reason, the username + the device seem to be black listed by Cognito, or there is some sort of cache somewhere that suggests that a if a username + device is believe used that it belongs to an AWS account that no longer exists? I'll try to debug more and report back if I find anything more. |
So @eax32 was spot on, I delete the |
@alphamu When the user signs out, do you call the appropriate |
Yes, I do. As far as I can tell, it doesn't clear the shareprefernces, in this or any other AWS shareprefernce file. |
@alphamu @eax32 However the Also do you use the rememberDevice functionality through our SDK where it remembers the device the end user is using by storing metadata in the Please correct my understanding: When autoBackup is enabled, Android backs up the SharedPreferences files and then restores when the app is reinstalled again. So the current workaround would be to clear the SharedPreferences upon a user signOut besides what the SDK does. |
I wasn't switching devices and I haven't explicit set autoBackup in my
manifest. All my phone's were signed in with the same account, yet
installing the app and signing into an other phone worked.
I am not using remember last known user. Is the SDK configured to remember
the last known user by default? This could explain why even though I
uninstalled the app, the issue remained after reinstalling the app.
Regards
…On Fri., 7 Jun. 2019, 3:40 am Karthikeyan, ***@***.***> wrote:
@alphamu <https://github.com/alphamu> @eax32 <https://github.com/eax32>
AWSMobileClient.signOut() internally calls CognitoUser.signOut() which
clears the tokens cached in the SharedPreferences. It clears the access
token, id token and refresh token.
However the lastKnownUser field is not cleared from the CognitoIdentityProviderCache
SharedPreferences and.
Also do you use the rememberDevice functionality through our SDK where it
remembers the device the end user is using by storing metadata in the
CognitoIdentityProviderDeviceCache SharedPreferences`.
Please correct my understanding: When autoBackup is enabled, Android backs
up the SharedPreferences files and then restores when the app is
reinstalled again. So the current workaround would be to clear the
SharedPreferences upon a user signOut besides what the SDK does.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#940?email_source=notifications&email_token=AAGOJDDMETOZMD7IUQIV24DPZFDW3A5CNFSM4HK6I4V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXDTR2Y#issuecomment-499595499>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGOJDBL4U753QXXBOZCGXDPZFDW3ANCNFSM4HK6I4VQ>
.
|
Just checked, seems allowBackup is true by default in the Manifest.
…On Fri., 7 Jun. 2019, 3:40 am Karthikeyan, ***@***.***> wrote:
@alphamu <https://github.com/alphamu> @eax32 <https://github.com/eax32>
AWSMobileClient.signOut() internally calls CognitoUser.signOut() which
clears the tokens cached in the SharedPreferences. It clears the access
token, id token and refresh token.
However the lastKnownUser field is not cleared from the CognitoIdentityProviderCache
SharedPreferences and.
Also do you use the rememberDevice functionality through our SDK where it
remembers the device the end user is using by storing metadata in the
CognitoIdentityProviderDeviceCache SharedPreferences`.
Please correct my understanding: When autoBackup is enabled, Android backs
up the SharedPreferences files and then restores when the app is
reinstalled again. So the current workaround would be to clear the
SharedPreferences upon a user signOut besides what the SDK does.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#940?email_source=notifications&email_token=AAGOJDDMETOZMD7IUQIV24DPZFDW3A5CNFSM4HK6I4V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXDTR2Y#issuecomment-499595499>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGOJDBL4U753QXXBOZCGXDPZFDW3ANCNFSM4HK6I4VQ>
.
|
@kvasukib our workaround is to clear shared prefs before signin. |
I am closing this issue and linking to the main issue #937 where we track this bug. |
Describe the bug
For some users we received logs like that while user try to pass authentication with Cognito. In most cases (all?), this happened after token expiration(?) and next uninstalling and reinstalling the application with Google autobackups enabled. Signout or other attempts to clean cache do not lead to success.
To Reproduce
Looks like it can be reproduced after expiring some tokens and next user delete the app and reinstall again. (Google auto backup is enabled for app, so may be this is the problem)
Which AWS service(s) are affected?
AWS Cognito Auth
Expected behavior
App should pass authentication.
Environment Information (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: