简体   繁体   English

如何在颤振应用程序中获取 Firebase 安装身份验证令牌?

[英]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.

相关问题 Flutter Firebase电话身份验证-如何获取身份验证令牌 - Flutter firebase phone authentication - how to get auth token 如何从 Flutter 上的 Firebase Auth 获取用户 ID 令牌更改 - How to get user ID token changes from Firebase Auth on Flutter FirebaseRemoteConfigClientException:Firebase 安装无法获取用于获取的安装授权令牌 - FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch 如何在 Android 登录中获取 Firebase 身份验证令牌 - How to get Firebase auth token in Android login 如何在一个扑动的应用程序中使用firebase phone auth - How to do firebase phone auth in a flutter app 如何始终获取最新的 Firebase Auth Token - How to always get latest Firebase Auth Token 登录Firebase auth,在flutter测试中获取Id token - Log in Firebase auth and get Id token in flutter tests 如何修复 firebase 身份验证在 dart 应用程序中的 Z5ACEBC7CB7AB70DDACBBAE074B 文件中导入后出现的 firebase 错误? - How to fix the firebase error I get after importing firebase auth in my dart file in flutter app? Firebase 在 Flutter 应用程序中使用 WebView 进行身份验证 - Firebase Auth in a Flutter app with WebView Flutter Firebase Auth - 捕获过期的令牌 - Flutter Firebase Auth - Catching expired token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM