Skip to content

Commit 38f8870

Browse files
committed
Update Google sign-in logic and dependencies
Refactored Google sign-in to use the new GoogleSignIn API and updated authentication flow. Also updated several dependencies in pubspec.yaml to their latest versions and incremented the package version to 0.5.5.
1 parent abb6fe8 commit 38f8870

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

lib/src/components/supa_socials_auth.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ class _SupaSocialsAuthState extends State<SupaSocialsAuth> {
158158
required String? webClientId,
159159
required String? iosClientId,
160160
}) async {
161-
final GoogleSignIn googleSignIn = GoogleSignIn(
161+
final GoogleSignIn googleSignIn = GoogleSignIn.instance;
162+
await googleSignIn.initialize(
162163
clientId: iosClientId,
163164
serverClientId: webClientId,
164165
);
165166

166-
final googleUser = await googleSignIn.signIn();
167-
final googleAuth = await googleUser!.authentication;
168-
final accessToken = googleAuth.accessToken;
167+
final googleUser = await googleSignIn.authenticate();
168+
final googleAuth = googleUser.authentication;
169+
final accessToken = googleAuth.idToken;
169170
final idToken = googleAuth.idToken;
170171

171172
if (accessToken == null) {
@@ -217,7 +218,7 @@ class _SupaSocialsAuthState extends State<SupaSocialsAuth> {
217218
_gotrueSubscription =
218219
Supabase.instance.client.auth.onAuthStateChange.listen((data) {
219220
final session = data.session;
220-
if (session != null && mounted) {
221+
if (session != null && mounted && session.user.isAnonymous != true) {
221222
widget.onSuccess.call(session);
222223
if (widget.showSuccessSnackBar) {
223224
context.showSnackBar(localization.successSignInMessage);

pubspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: supabase_auth_ui
22
description: UI library to implement auth forms using Supabase and Flutter
3-
version: 0.5.4
3+
version: 0.5.5
44
homepage: https://supabase.com
55
repository: 'https://github.com/supabase-community/flutter-auth-ui'
66

@@ -11,17 +11,17 @@ environment:
1111
dependencies:
1212
flutter:
1313
sdk: flutter
14-
supabase_flutter: ^2.5.6
15-
email_validator: ^2.0.1
16-
font_awesome_flutter: ^10.6.0
17-
google_sign_in: ^6.2.1
18-
sign_in_with_apple: ^6.1.0
19-
crypto: ^3.0.3
14+
supabase_flutter: ^2.10.3
15+
email_validator: ^3.0.0
16+
font_awesome_flutter: ^10.12.0
17+
google_sign_in: ^7.2.0
18+
sign_in_with_apple: ^7.0.1
19+
crypto: ^3.0.7
2020

2121
dev_dependencies:
2222
flutter_test:
2323
sdk: flutter
24-
flutter_lints: ^4.0.0
24+
flutter_lints: ^6.0.0
2525

2626
flutter:
2727
assets:

0 commit comments

Comments
 (0)