Comments (12)
What we see from logs, most cases are for the users that were not using the application for quite some time, so that the access token is expired, then when trying to refresh the tokens we get the No cached session.
Refresh tokens also have an expiration configured. What is the refresh token expiration set to in Cognito? Once a refresh token has expired, the user will need to sign in again.
from aws-sdk-android.
What we see from logs, most cases are for the users that were not using the application for quite some time, so that the access token is expired, then when trying to refresh the tokens we get the No cached session.
Refresh tokens also have an expiration configured. What is the refresh token expiration set to in Cognito? Once a refresh token has expired, the user will need to sign in again.
We have 730 days of expiration set for the project. So thats not the case. Also we're not experiencing similar issues on iOS where we have even more users.
from aws-sdk-android.
Can you provide your awsconfiguration file with sensitive information obfuscated? Additionally, what sign in type are you using?
from aws-sdk-android.
As for the sign in type - I'm not sure which one is the most affected, but we're having password, facebook and google - we dont know which method was used when we get No cached session
from aws-sdk-android.
Hi @m-zagorski, that is helpful but looking for the awsconfiguration.json file in your app/src/res/raw folder.
I was trying to also figure out what sign in method you were using. It sounds like if you are using password, facebook, and google, you are using the hosted (web) ui sign in flow and not SRP.
If this is the case, please check the awsconfiguration.json file and see if openid is listed under the Scopes. If this is missing, the refresh token will not work.
from aws-sdk-android.
Hey, we have openid
set in scopes: "Scopes": ["openid", "email", "profile"]
- and for the sign in method - we're using mostly the hosted (web) ui sign in flow (we have changed google recently but this did not affect the case of No cached session
from aws-sdk-android.
@m-zagorski I've got a few questions to continue asking.
- Do you also have non-hosted (SRP sign in) capabilities in the app as well?
- Do you have any data that would indicate that this issue may be coming from a specific sign in flow type?
- If you are seeing almost 1k/day, would you happen to know if this is 1k users? Or could this be a small number of users that continue to attempt to make many network calls.
- If you have an identical dev environment set up, have you attempted to lower id token and refresh expirations to see if you can replicate the message seen?
- How long has your app been released? Is it possible some users are starting to hit 730 days?
- Have their been changes to refresh token expiration times (ex: older sign ins would have the older value, not 730)
Please try and provide the awsconfiguration.json file so that we can take a further look and make sure nothing looks misconfigured on that file.
from aws-sdk-android.
Hello, so:
- We do not have any sign-in capabilities that bypass the cognito flow - even if we are not using web hosted ui, we're relying on cognito methods to sign in users
- Looking at the analytics, most common use case is when users get a notification and this triggers app request which fails - we've checked and the AWS client is initialized, also we have user session details inside the application
- There are indeed users that get this more than once, so that 1k is not a unique number
- We have lowered the id token expiration to 5mins and unfortunately we couldnt reproduce it - we managed to get that once for an account that was unused for few days, but that gave us nothing interesting
- It might exceed 730 days, however looking at ios where we have a lot more users and no such issues I dont think thats the case - especially that some of the users are getting the error few times
- I will try to get that info but it might be hard to get (Im not sure if there is a changelog in there)
As for the awsconfiguration.json file here it comes: (staging one has exactly the same structure):
{
"IdentityManager": {
"Default": {},
"Custom": {}
},
"CognitoUserPool": {
"Default": {
"PoolId": "eu-west-1_****",
"AppClientId": "****",
"Region": "eu-west-1"
},
"Custom": {
"PoolId": "eu-west-1_****",
"AppClientId": "****",
"Region": "eu-west-1"
}
},
"Auth": {
"Default": {
"OAuth": {
"WebDomain": "accounts.hidden.com",
"AppClientId": "****",
"SignInRedirectURI": "hidden://sign-in",
"SignOutRedirectURI": "hidden://",
"Scopes": ["openid", "email", "profile"]
}
},
"Custom": {
"OAuth": {
"WebDomain": "accounts.hidden.com",
"AppClientId": "****",
"SignInRedirectURI": "hidden://sign-in",
"SignOutRedirectURI": "hidden://",
"Scopes": ["openid", "email", "profile"]
},
"authenticationFlowType": "CUSTOM_AUTH"
}
}
}
from aws-sdk-android.
@m-zagorski is it possible for you to provide detailed logs/stacktrace with sensitive information obfuscated? It would be helpful to understand under what condition no cached session messages are being logged to further identify root cause.
from aws-sdk-android.
@ankpshah Unfortunately we dont have full stacktrace - only the message from exception coming from cognito, I will check if we can change the logs so that we have full stacktrace
from aws-sdk-android.
@ankpshah Here is the stacktrace we're getting:
Non-fatal Exception: java.lang.Exception: No cached session.
at com.amazonaws.mobile.client.AWSMobileClient$11$1.signalTokensNotAvailable(AWSMobileClient.java:1968)
at com.amazonaws.mobile.client.AWSMobileClient$11$1.getAuthenticationDetails(AWSMobileClient.java:1948)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:1032)
at com.amazonaws.mobile.client.AWSMobileClient$11.run(AWSMobileClient.java:1929)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:923)
from aws-sdk-android.
Hello @m-zagorski,
Could you upgrade to AWS Android SDK v2.75.0 which provides a clear message during getTokens when there are no valid tokens on device. When doing so, please make sure that you update your implementation for the logic to check for failures.
The changes can be found here: 46fb3c3
Here is a quick summary:
If the token fails to refresh, the caller will receive an exception with "No cached session". The caller is already aware of this.
callback.onError(new Exception("No cached session.", exception));
However, sometimes provided inner exception was null. This is no longer the case, you will receive additional details about exception.
If you receive CognitoNotAuthorizedException
, this means that the tokens are no longer valid. The user can be signed out.
callback.onError(new Exception("No cached session.", new CognitoNotAuthorizedException("No valid tokens on device.")));
In any other exception case, the issue is likely to be transient. You may want to log this exception so you can report if you are seeing an abnormal amount of any other exception types.
from aws-sdk-android.
Related Issues (20)
- Return boolean result of put() in AbstractKinesisRecorder.saveRecord()
- com.amazonaws.AmazonClientException: Unable to execute HTTP request: Stream closed HOT 2
- Unable to connect over IOT for minSDK version 19 HOT 12
- Cognito Unable to cache Credentials HOT 9
- Can JDK17 Build aws-sdk-android 2.63.0 and Later? HOT 2
- How to disable the IPv6 address? HOT 1
- Neither aws-android-sdk-iot nor org.eclipse.paho.client.mqttv3 provide appropriate ProGuard/R8 rules HOT 1
- Keep service exception constructors after R8 minification HOT 3
- kinesis sdk to upload batches concurrently HOT 2
- Non-fatal Exception: com.amazonaws.AmazonClientException: Unable to execute HTTP request: timeout HOT 4
- Response timeout issues in the AWS SDK for Android HOT 20
- [Question&Help] Why receive DefaultDataset: Synchronize failed because it exceeded the maximum retries HOT 5
- Analytics SDK - Android - InitializationException in amazonmobileanalytics. Encountered an error accessing the file system HOT 2
- How to upload to s3 with endpoint URL HOT 2
- Android 14: Cognito Hosted UI auth redirect response fails to reopen app after successful login. HOT 11
- TransferNetworkConnectionType.MOBILE doesn't work when WiFi is connected on "no internet" network (API 25) HOT 1
- Resend MFA Code HOT 2
- Kinesis Video sending a video from External source HOT 4
- S3 UploadTask fails with some files HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-android.