问题
I am trying to backup the application data of my android app on Google Drive. Therefore I request access to the https://www.googleapis.com/auth/drive.appdata, https://www.googleapis.com/auth/drive.file scopes using the google_sign_in package.
I created a project on the Google Developer Console, enabled the Drive API and added the scopes to the OAuth Consent Screen and added an OAuth Client ID with the package name and the SHA-1 of the debug key.
The application works fine if I don't request any scopes, requesting the "drive" scopes however makes the consent screen being stuck and it keeps loading forever. Is there anything that I am missing?
Below are the code of the application and the stuck screen loading
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
Future<GoogleSignInAccount> handleSignIn() async {
try {
return await GoogleSignIn(
scopes: [
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.file',
],
).signIn();
} catch (error) {
print(error);
return null;
}
}
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text(""),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: const Text("Login with Google"),
onPressed: () {
() async {
final signInResult = await handleSignIn();
print(signInResult);
}();
},
),
],
),
),
)
);
}
}
来源:https://stackoverflow.com/questions/57831466/google-drive-consent-screen-stuck