- I am NOT using Firebase
- I am still in early developer phase, so not even tried to publish at all on Play Store
- My goal is to ask user to login to allow to upload photos to user’s google drive.
- This question is not duplicated due the fact that almost 100% of questions/answers are related to Firebase.
My code is the following.
Please note: I ask user to login to allow to upload photos to user’s Google drive.
import 'dart:developer';
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: <String>[
'https://www.googleapis.com/auth/drive.file',
],
);
class AuthManager {
static Future<GoogleSignInAccount?> signIn() async {
try {
final account = await _googleSignIn.signIn();
log('account: ${account?.toString()}', name: 'AuthManager');
return account;
} catch (error) {
log('signIn error:', name: 'AuthManager');
log(error.toString(), name: 'AuthManager');
return null;
}
}
static Future<void> signOut() async {
try {
_googleSignIn.disconnect();
} catch (error) {
print(error);
}
}
static Future<bool> isSignedIn() async {
return _googleSignIn.isSignedIn();
}
}
The error logged is
[AuthManager] signIn error:
[AuthManager] PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
I know that error number 10 is ‘developer error’, due to something misconfigured.
But what!!?!?
WHAT I HAVE ALREADY TRIED
-
I generated a key store for my app
My app is being signed in debug mode.
Nothing changes, same exception
-
I created a oauth client for my app using package name and sha1 read from the generated keystore
I do not know how will Goggle login connect my flutter app with this oauth credential
Nothing changes, same exception number 10
2
Answers
Implemented similar thing, you need to generate keystore. Follow this guide for detailed answer. I suggest you to follow Android Studio Key Generation Steps.
Try the following (ignore the steps that you have already done)
./gradlew signingReport