How to get firebase installation auth token in flutter app?

1.1k views Asked by At

I'm creating Firebase Remote config experiment with A/B testing for my Flutter app. For validating the experiment on test device I need to get Firebase installation auth token that associated with each Firebase installation.

How can I get this token in "Flutter-way"? In docs there is way to get it for Swift, Kotlin etc.. But not for Dart/Flutter.

In my app I have firebase_core package installed and FirebaseOptions has a bunch of ids:

this.apiKey,
this.appId,
this.messagingSenderId,
this.projectId,
this.measurementId,

But no Firebase Installation Auth Token.

2

There are 2 answers

0
Almund On

The easiest way is if you've got the firebase cloud messaging installed as well, getting the token from there. 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.

https://pub.dev/packages/firebase_device_id

0
Lee3 On

firebase_app _installations is a new Flutter package from the Firebase dev team that I believe will provide you with what you need.