Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sign out of oauth provider #111

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add auth ui specific sign out method
  • Loading branch information
FatumaA committed Sep 6, 2024
commit de702c93066d03da6fddbc0e63eeb2367a59ea38
22 changes: 22 additions & 0 deletions lib/src/utils/supa_oauth_signout.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:flutter/foundation.dart';
import 'dart:io';

class SupaOauthSignout {
static Future<void> signOut() async {
try {
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
final googleSignIn = GoogleSignIn();
if (await googleSignIn.isSignedIn()) {
await googleSignIn.signOut();
}
}
await Supabase.instance.client.auth.signOut();
} catch (error) {
throw AuthException(
'Failed to sign out: ${error.toString()}',
);
}
}
}