isAuthenticated method
Returns whether the user is currently authenticated.
This method does not perform any login completion or mutate state. It only checks if there is a valid, non-expired auth state and confirms token validity.
⚠️ If your app supports web-based login flows, make sure to call completePendingLoginIfNeeded first to finalize any in-progress authentication before calling this.
Implementation
Future<bool> isAuthenticated() async {
final hasValidAuthState = authState != null && !authState!.isExpired();
return hasValidAuthState && await _checkToken();
}