flutter - 如何使用预设的电子邮件和密码登录 google oauth?
问题描述
我正在为客户开发一个颤振应用程序。
这涉及将文件上传到 Google 驱动器文件夹。
我已经让它与谷歌登录弹出窗口一起使用,但他们想要它,以便使用的帐户与设备帐户分开。
这可能吗?
我不认为服务帐户是正确的,因为他们仍然希望在应用程序设置中设置电子邮件和密码,据我所知,服务帐户需要直接在 API 控制台中创建和链接。
编辑:这是我当前使用 Google 登录插件登录的代码;
static final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
g.DriveApi.DriveScope,
g.DriveApi.DriveMetadataReadonlyScope
]
);
static dynamic token;
...
static login() async{
try {
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth = await googleUser
.authentication;
print("signed in " + googleAuth.accessToken);
token = googleAuth.accessToken;
_authHeaders = await _googleSignIn.currentUser.authHeaders;
}catch(exception){
//maybe offline
print("login error: "+exception.toString());
}
}
那么是否可以使用电子邮件和密码而不是这种方法(显示帐户选择弹出窗口)?
解决方案
推荐阅读
- python - 如何在 asyncio 中同时运行任务?
- ios - 如何在 Swift 中参数化变量?
- angular - Angular 7 webpack 服务器端渲染创建 ReferenceError: HTMLAnchorElement is not defined
- java - Cassandra 高 cpu 负载问题 (3.11.1)
- python - 切换到python 64位后出现内存错误
- html - 没有为 GitHub 页面加载 CSS
- javascript - 嵌入式 iframe 是如何工作的?
- javascript - 如何将下拉列表的默认值设置为 Reactjs 中的状态变量
- node.js - 记录 mocha 测试错误的响应正文?
- android - 使用 rxjava2 测试直到成功