When i try to SignIn with Google google_sign_in: ^6.1.6
I got an error
[GSI_LOGGER-OAUTH2_CLIENT]: Popup timer stopped.
[GSI_LOGGER-TOKEN_CLIENT]: Trying to set gapi client token.
[GSI_LOGGER-TOKEN_CLIENT]: The OAuth token was not passed to gapi.client, since the gapi.client library is not loaded in your page.
This is My Code :
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_sign_in/google_sign_in.dart';
final authRepositoryProvider = Provider((ref) {
return AuthRepository(googleSignIn: GoogleSignIn());
});
class AuthRepository {
final GoogleSignIn _googleSignIn;
AuthRepository({
required GoogleSignIn googleSignIn,
}) : _googleSignIn = googleSignIn;
void googleSignIn() async {
try {
final user = await _googleSignIn.signIn();
if (user != null) {
print(user.email);
print(user.displayName);
}
} catch (e) {
print(e);
}
}
}
Anybody encountered this problem and been able to solve it?
2
Answers
I have used this function recently in my project and it work
for more help follow this blog
https://petercoding.com/firebase/2021/05/24/using-google-sign-in-with-firebase-in-flutter/
if you understand Hindi/Urdu language follow this video for latest documentation and method
https://youtu.be/rt7B4tD67Gw
I see that you are working with Flutter Web.
Have you done the Web Implementation for google_sign_in package?
Also, I found a great tutorial for your problem: https://codeontherocks.dev/blog/google-sign-in-flutter/
He wrote this about the error that you see:
Please check the example repository as well 🙂