我正在使用 flutter web 和 firebase 身份验证来构建一个 web 应用程序。为此 1. 使用 Google 登录作为登录方法之一创建了 Firebase 应用程序。2. 添加了https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_auth/firebase_auth/example 和https://dart-pub.mirrors.sjtug.sjtu.edu.cn/ 中给出的依赖项包/firebase_auth_web。
当我尝试登录时,会出现 Google 登录窗口。一旦我输入电子邮件地址并按回车键,就会出现以下错误。
“无法登录此浏览器或应用程序可能不安全。请尝试使用其他浏览器。如果您已经在使用受支持的浏览器,您可以刷新屏幕并再次尝试登录。”
我用的是 Chrome 浏览器。我应该怎么做才能使我的应用程序更安全?对于 android,我们可以选择使用 SHA 密钥来加密连接。我们需要为 web 做类似的事情吗?
firebase firebase-authentication google-signin flutter flutter-web
我试图使用 Cloud run 运行 Docker 映像,并意识到没有添加持久存储的选项。我在https://cloud.google.com/run/docs/using-gcp-services#connecting_to_services_in_code 中找到了一个服务列表,但它们都是从代码访问的。我希望与持久存储共享卷。有办法解决吗?是因为持久存储可能无法同时在多个实例之间共享吗?是否有替代解决方案?
观看此视频以了解问题演示 https://youtu.be/GsdWcTEbUbg
由于代码较多,我在这里尝试总结一下代码的结构。简而言之:
Scaffold(
appBar: AppBar(),
body: StreamBuilder<dynamic>(
stream: globals.chatRoomBloc.threadScreen,
builder: (BuildContext context, AsyncSnapshot snapshot) {
return Column(
crossAxisAlignment:
CrossAxisAlignment.stretch, // sticks to the keyboard
children: <Widget>[
Expanded(
child: Scrollbar(
child: ListView.builder(
shrinkWrap: true,
itemCount: list.length,
itemBuilder: (BuildContext context, int index) {
return TileWidget();
},
),
),
),
],
);
},
),
)
Run Code Online (Sandbox Code Playgroud)
TileWidget 是有状态的,当按下回复按钮时会附加 TextField 并调整小部件的大小。然后,当用户单击文本字段时,键盘就会弹出。
现在我的问题是,当键盘弹出时,屏幕会重新加载。
我尝试了以下解决方案:
我认为屏幕正在尝试调整大小并重新绘制以适应键盘抽屉。但由于某种原因未能做到这一点并重新加载所有内容。我错过了什么吗?有没有解决的办法 ?
我试图测试我的 flutter 应用程序的主屏幕登录。我正在使用 Flutter 中的 google-signin ( https://pub.dev/packages/google_sign_in ) 包来执行登录和身份验证。因此,一旦按下登录按钮,就会出现一个弹出窗口,要求用户选择用户帐户。那时,我无法控制点击,因为该对话框屏幕是由插件生成的。在这种情况下如何实现用户帐户的选择?
test('Test Login', () async {
final Timeline timeline = await driver.traceAction(() async {
await driver.tap(find.byValueKey('GoogleLogin'));
await driver.tap(find.text('myemail@gmail.com')); // This will not work !!!
});
TimelineSummary.summarize(timeline)
..writeSummaryToFile('home_scroll_perf', pretty: true)
..writeTimelineToFile('home_scroll_perf', pretty: true);
});
Run Code Online (Sandbox Code Playgroud)
在我看来,在使用任何第三方插件进行测试时这可能是一个问题。请帮忙。
我们能否在验证后从 Flutter 表单中获取错误字段列表?这将帮助开发人员使用焦点节点将注意力重定向到错误的字段。
我正在使用带有 M1 芯片的 Macbook Pro。我安装了
Android Studio 4.2.1 Build #AI-202.7660.26.42.7351085,于 2021 年 5 月 10 日构建运行时版本:11.0.8+10-b944.6916264 x86_64 VM:OpenJDK 64-Bit Server VM by N/A GC 16 macOS 10 G1 Young Generation, G1 Old Generation 内存:1280M 内核:8 注册表:external.system.auto.import.disabled=true
名称:Pixel_4_API_S CPU/ABI:Google APIs ARM (arm64-v8a) 路径:/Users/vineethpalani/.android/avd/Pixel_4_API_S.avd Target:google_apis [Google APIs] (API level S) Skin:pixel_4 SD Card:512M fastboot .chosenSnapshotFile: runtime.network.speed: full hw.accelerometer: yes hw.device.name: pixel_4 hw.lcd.width: 1080 image.androidVersion.codename: S hw.initialOrientation: Portrait image.androidVersion.api: 30 tag。 id: google_apis hw.mainKeys: no hw.camera.front: emulated avd.ini.displayname: Pixel …
据我所知,如果发生以下情况之一,FCM 令牌会自行更新。
-应用程序删除实例ID
-应用程序在新设备上恢复
-用户卸载/重新安装应用程序
-用户清除应用程序数据。
App端可以使用以下方法来监控Token更新。
监控代币生成
每当生成新令牌时都会触发 onTokenRefreshcallback,因此在其上下文中调用 getToken 可确保您正在访问当前可用的注册令牌。确保您已将服务添加到清单中,然后在 onTokenRefresh 的上下文中调用 getToken,并记录值,如下所示:
@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
sendRegistrationToServer(refreshedToken);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,当应用程序终止时,令牌就会过期,并且 FCM 服务器无法知道设备的新令牌是什么(如果存在)。因此,当我向该设备发送通知/数据消息时,服务器无法将其发送到设备,因为它不知道将其发送到哪里(因为没有有效的令牌)。如何确保在这种情况下我可以通知设备?我不生成客户令牌。所以它似乎时不时地刷新令牌。如何提高令牌的有效性?
android firebase firebase-cloud-messaging google-cloud-firestore
运行时出现以下错误flutter run -d chrome
。我无法弄清楚此错误的来源。我在这里尝试了解决方案,但没有改变任何东西。
Doctor 总结(要查看所有详细信息,请运行 flutter doctor -v):[?] Flutter(渠道未知,1.20.2,Linux,语言环境 en_CA.UTF-8)[?] Android 工具链 - 为 Android 设备开发(Android SDK)版本 30.0.0) [?] Chrome - 为网络开发 [?] Android Studio(版本 4.0)[?] 连接的设备(4 个可用)
能否请你帮忙 ?
client.js:3316 Unhandled error detected in the injected client.js script.
You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.
The original error …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将数据从外部 webhook/RSS 源流式传输到我的数据流中。我正在考虑使用发布/订阅来接收消息,然后在数据流中处理它。但是,我找不到这样做的选项。
除了设置侦听输入流的接收者队列服务器之外,是否有更好的方法在 GCP 作为托管服务中执行此操作?
google-cloud-platform google-cloud-pubsub google-cloud-dataflow apache-beam
因此,我正在为在计算引擎上运行的应用程序设置 API 网关。由于我找不到任何有关如何在 API 引擎上配置计算引擎的文档,因此我使用内部 DNS 创建了以下配置。在此输入链接描述
swagger: "2.0"
info:
title: API Endpoints
description: API Endpoints
version: 1.0.1
schemes:
- https
produces:
- application/json
paths:
/indexes:
get:
summary: Return Search Indexes
operationId: searchIndexes
x-google-backend:
address: http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes
path_translation: APPEND_PATH_TO_ADDRESS
responses:
"200":
description: A successful response
schema:
type: string
"403":
description: Failed to authenticate
Run Code Online (Sandbox Code Playgroud)
当我使用gcloud部署配置时,出现以下错误
等待为 API [my-api] 创建 API 配置 [my-api-config-v6]...失败。
错误:(gcloud.beta.api-gateway.api-configs.create)等待服务配置创建:后端 URL“http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes”被禁止:无法将请求路由到内部地址。
所以看起来内部 DNS 不受支持(显然)。
我的计算引擎实例只能通过 VPC 网络访问。如何将我的 api 网关连接到 VPC 网络以及如何通过它访问我的计算引擎?
google-compute-engine google-cloud-platform google-vpc google-api-gateway
flutter ×5
android ×2
dart ×2
firebase ×2
flutter-web ×2
apache-beam ×1
apple-m1 ×1
flutter-test ×1
google-vpc ×1
macos ×1