可以从Firebaseauth创建一个授权客户端以访问Flutter Web中的Googleapis吗?
我正在尝试在我的Flutter Web应用程序中使用Secretmanagerapi。
这就是我到目前为止得到的:
import 'package:googleapis_auth/auth_io.dart';
import 'package:googleapis/secretmanager/v1.dart';
...
final client await clientViaApplicationDefaultCredentials(
scopes: [FirestoreApi.cloudPlatformScope]);
final api = SecretManagerApi(client);
final secrets = await api.projects.secrets.versions.access(<YOUR_SECRET_NAME>);
print(secrets.payload!.data.toString());
...
但是由于client> clientviaapplicationdefaultcredentials
use dart:io
,这是不可用于Flutter Web。
由于我使用firebase来验证用户,因此我想知道是否可以从Firebase身份验证数据中创建这样的经过认证的客户端?
毕竟,用户已经对/使用Google产品进行身份验证。
如果不可能,我如何为Flutter Web应用程序创建一个已验证的客户端?
以下是一些其他要求:
- 我不想将googleauth用作firebase的身份验证方法,
- 我不想要任何弹出式屏幕
I am trying to use the SecretManagerApi in my Flutter Web app.
This is what I got so far:
import 'package:googleapis_auth/auth_io.dart';
import 'package:googleapis/secretmanager/v1.dart';
...
final client await clientViaApplicationDefaultCredentials(
scopes: [FirestoreApi.cloudPlatformScope]);
final api = SecretManagerApi(client);
final secrets = await api.projects.secrets.versions.access(<YOUR_SECRET_NAME>);
print(secrets.payload!.data.toString());
...
but this fails because clientViaApplicationDefaultCredentials
uses dart:io
which is not available for Flutter Web.
Since I use Firebase to authenticate my users, I was wondering if it is possible to create such an authenticated client from the Firebase authentication data?
After all, the user is already authenticated for/with a Google product.
If this is not possible, how can I create an authenticated client for a Flutter Web App?
Here are some additional requirements:
- I don't want to use GoogleAuth as authentication method for Firebase
- I don't want any popups or consent screens
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论