Skip to content
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

If a user is offline and their access token expires, but their refresh token is still valid (unexpired at last sync), the isSigned function for the session should return true. Currently it returns false. #2783

Open
1 task done
aneeshjoshi opened this issue Apr 19, 2024 · 4 comments
Assignees
Labels
auth Related to the Auth category/plugins bug Something isn't working

Comments

@aneeshjoshi
Copy link

Before opening, please confirm:

Language and Async Model

Kotlin - Coroutines

Amplify Categories

Authentication

Gradle script dependencies

// Put output below this line
    implementation("com.amplifyframework:aws-storage-s3:2.15.1")
    implementation("com.amplifyframework:aws-auth-cognito:2.15.1")
    implementation("com.amplifyframework:core-kotlin:2.15.1")

Environment information

# Put output below this line

Welcome to Gradle 8.1!

Here are the highlights of this release:
 - Stable configuration cache
 - Experimental Kotlin DSL assignment syntax
 - Building with Java 20

For more details see https://docs.gradle.org/8.1/release-notes.html


------------------------------------------------------------
Gradle 8.1
------------------------------------------------------------

Build time:   2023-04-12 12:07:45 UTC
Revision:     40ba32cde9d6daf2b92c39376d2758909dd6b813

Kotlin:       1.8.10
Groovy:       3.0.15
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          21.0.1 (Oracle Corporation 21.0.1+12-29)
OS:           Mac OS X 14.2.1 aarch64

Please include any relevant guides or documentation you're referencing

https://docs.amplify.aws/flutter/build-a-backend/auth/accessing-credentials/

Describe the bug

If a user is offline and their access token expires, but their refresh token is still valid (unexpired at last sync), the isSigned function for the session should return true. Currently it returns false.

The behaviour should work similar to how the Amplify Flutter library resolved this in
aws-amplify/amplify-flutter#2585
to address Issue aws-amplify/amplify-flutter#2398

Alternatively, there should be a way for the api users to determine that the reason for the null access token. Currently the exception being thrown is aws.smithy.kotlin.runtime.http.HttpException: java.net.UnknownHostException and it's several layers deep within the error object

Reproduction steps (if applicable)

Setup a user pool client to have 7 min access & id token expiry and refresh token set to 60 days
Sign in to an android app app using that user pool client
Request the auth session on app launch, observe isSignedIn as true from the session retrieved
Set your device to Airplane Mode (no wifi or cell network)
Wait 8 mins, launch the app, observe isSignedIn as false from the session retrieved

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@github-actions github-actions bot added the pending-triage Issue is pending triage label Apr 19, 2024
@joon-won
Copy link
Contributor

Thank you for your report. Our team will take a look into the issue

@joon-won joon-won added bug Something isn't working auth Related to the Auth category/plugins labels Apr 19, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Apr 19, 2024
@vincetran vincetran self-assigned this Apr 23, 2024
@vincetran
Copy link
Contributor

Hi @aneeshjoshi, I'll be taking a look at this issue starting today. Will keep you updated as I dig further into the auth code and the Flutter issue (thanks for linking that!)

@sami-khleaf
Copy link

We've had this issue in out apps since we're using the latest versions of amplifys frequent updates,
We had to fix it somehow so we logged out the user from the app before every login unconditionally since the fetch session give faulty info about the user being signed in or not.

Hope this gets fixed soon 🙏

@tylerjroach
Copy link
Contributor

Hi @sami-khleaf,

I'm working on a fix now.

I'll update the ticket with progress as I have updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Related to the Auth category/plugins bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants