Skip to content

Commit 347eb98

Browse files
authored
Merge pull request #616 from anusii/av/614_fix_logout_issue
av/614_fix_logout_url_retrieve_issue
2 parents 7b1d5b8 + d374cd8 commit 347eb98

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/src/solid/utils/misc.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,10 @@ Future<bool> logoutPod() async {
453453
await KeyManager.clear();
454454
debugPrint('logoutPod() => KeyManager.clear() completed');
455455

456-
// Step 2: Remove authentication data from secure storage
456+
// Step 2: Get the logout URL before removing auth data
457+
final logoutUrl = await AuthDataManager.getLogoutUrl();
458+
459+
// Step 3: Remove authentication data from secure storage
457460
// This is CRITICAL - must succeed
458461
final authDataRemoved = await AuthDataManager.removeAuthData();
459462
if (!authDataRemoved) {
@@ -463,7 +466,7 @@ Future<bool> logoutPod() async {
463466
// Don't return false yet - logout endpoint is still needed
464467
}
465468

466-
// Step 2.5: Clear application-specific caches BEFORE network call
469+
// Step 3.5: Clear application-specific caches BEFORE network call
467470
// This is CRITICAL to prevent race conditions where UI reads stale cache
468471
// during logout, especially when network is slow
469472
if (_onLogoutClearCaches != null) {
@@ -479,9 +482,8 @@ Future<bool> logoutPod() async {
479482
debugPrint('logoutPod() => No application cache callback registered');
480483
}
481484

482-
// Step 3: Get the logout URL and attempt OAuth2 logout
485+
// Step 4: Attempt OAuth2 logout
483486
// This is OPTIONAL - should not block if it fails
484-
final logoutUrl = await AuthDataManager.getLogoutUrl();
485487
if (logoutUrl != null && logoutUrl.isNotEmpty) {
486488
try {
487489
// Call the OAuth2 logout endpoint

0 commit comments

Comments
 (0)