[英]How to get firebase installation auth token in flutter app?
I'm creating Firebase Remote config experiment with A/B testing for my Flutter app.我正在为我的 Flutter 应用程序创建带有 A/B 测试的 Firebase 远程配置实验。 For validating the experiment on test device I need to get
Firebase installation auth token
that associated with each Firebase installation.为了在测试设备上验证实验,我需要获取与每个 Firebase 安装关联的
Firebase installation auth token
。
How can I get this token in "Flutter-way"?我怎样才能在“Flutter-way”中获得这个令牌? In docs there is way to get it for Swift, Kotlin etc.. But not for Dart/Flutter.
在文档中,有办法为 Swift、Kotlin 等获取它。但不适用于 Dart/Flutter。
In my app I have firebase_core
package installed and FirebaseOptions has a bunch of ids:在我的应用程序中,我安装了
firebase_core
包,并且 FirebaseOptions 有一堆 id:
this.apiKey,
this.appId,
this.messagingSenderId,
this.projectId,
this.measurementId,
But no Firebase Installation Auth Token.但没有 Firebase安装身份验证令牌。
The easiest way is if you've got the firebase cloud messaging installed as well, getting the token from there.最简单的方法是,如果您还安装了 firebase 云消息传递,则从那里获取令牌。 In my app I didn't so I wanted to figure this out myself so I wrote a small package to solve this.
在我的应用程序中我没有,所以我想自己解决这个问题,所以我写了一个小包来解决这个问题。
I'm not sure if it works on any type of device as I've only tried it locally on the devices I have (Android and iOS) but using this token you can do the AB testing in firebase console.我不确定它是否适用于任何类型的设备,因为我只在我拥有的设备(Android 和 iOS)上本地尝试过,但使用此令牌您可以在 firebase 控制台中进行 AB 测试。
https://pub.dev/packages/firebase_device_id https://pub.dev/packages/firebase_device_id
firebase_app _installations是 Firebase 开发团队的一个新的 Flutter 包,我相信它会为您提供所需的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.