diff --git a/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart b/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart index da2c66b56c4..9e8a80d2c5e 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart @@ -28,8 +28,18 @@ abstract class AuthService { Future get currentUser; + /// Checks to see if a user has a valid session. + /// + /// A valid session is a session in which the tokens are not expired, OR + /// the access/id tokens have expired but the state of the refresh token is + /// unknown due to network unavailability. Future isValidSession(); + /// Checks if a user is logged in based on whether or not there are + /// tokens on the device. + /// + /// This will not check whether or not those tokens are valid. To check + /// if tokens are valid, see [isValidSession]. Future get isLoggedIn; Future resetPassword(String username); @@ -191,9 +201,8 @@ class AmplifyAuthService Future get isLoggedIn async { return _withUserAgent(() async { try { - final result = await Amplify.Auth.fetchAuthSession(); - - return result.isSignedIn; + await Amplify.Auth.getCurrentUser(); + return true; } on SignedOutException { return false; }