isLoggedIn static method

bool isLoggedIn()

Check if user is logged in Returns true if token is valid OR if a refresh token is available

Implementation

static bool isLoggedIn() {
  final config = loadConfig();
  if (config?.auth == null) return false;

  final auth = config!.auth!;
  if (auth.type == AuthType.apiKey && auth.apiKey != null) {
    return true;
  }

  if (auth.type == AuthType.jwt && auth.token != null) {
    if (!auth.isExpired) return true;
    // Token expired but refresh token available — still considered logged in
    if (auth.refreshToken != null) return true;
  }

  return false;
}