Google Drive Consent Screen Stuck

被刻印的时光 ゝ 提交于 2021-02-16 05:21:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!