You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
I would expect a consistent behaviour, either always throwing an exception or never doing that for offline logout.
Additional considerations
I checked the Supabase logout function and my guess is that the first time triggering an offline logout the function removes the accessToken and then tries to try catch block, triggering the exception. The second time using the offline logout, there is no more an accessToken and therefore it doesn't go in the try catch block.
Supabase Flutter Logout
Future<void> signOut({
SignOutScope scope =SignOutScope.global,
}) async {
final accessToken = currentSession?.accessToken;
if (scope !=SignOutScope.others) {
_removeSession();
await _asyncStorage?.removeItem(
key:'${Constants.defaultStorageKey}-code-verifier');
_notifyAllSubscribers(AuthChangeEvent.signedOut);
}
if (accessToken !=null) {
try {
await admin.signOut(accessToken, scope: scope);
} onAuthExceptioncatch (error) {
// ignore 401s since an invalid or expired JWT should sign out the current session// ignore 404s since user might not exist anymoreif (error.statusCode !='401'&& error.statusCode !='404') {
rethrow;
}
}
}
}
The text was updated successfully, but these errors were encountered:
I'm unsure what the solution to this issue should be. Throwing a socket exception although no request would have been made doesn't make sense. I think you should just check before calling the sign out method whether a session even exists or not. Since signing out when no session exists doesn't change anything.
So I think the current implementation is the desired way.
Describe the bug
When offline, using the logout function:
To Reproduce
My Logout function code:
Expected behavior
I would expect a consistent behaviour, either always throwing an exception or never doing that for offline logout.
Additional considerations
I checked the Supabase logout function and my guess is that the first time triggering an offline logout the function removes the accessToken and then tries to try catch block, triggering the exception. The second time using the offline logout, there is no more an accessToken and therefore it doesn't go in the try catch block.
Supabase Flutter Logout
The text was updated successfully, but these errors were encountered: