David
David

Reputation: 1680

Storing API keys in a Flutter Firebase app? Do I need to hide them? How?

I am developing an iOS/Android app with Flutter and Firebase (mainly Cloud FireStore and Firebase Auth). According to the Firebase documentation/example, they just put the API key along with the googleAppID straight into the app's source code. This to me seems very insecure, but at the same time I did hear that dart is compiled AOT. So what is the best practice for putting the Firebase API keys in a Flutter app?

Any response is appreciated!

Upvotes: 4

Views: 5661

Answers (1)

Christopher Moore
Christopher Moore

Reputation: 17123

That example is usually not followed. The key is stored in the google-services.json file or the equivalent for iOS that should be added to the project following the Firebase setup instructions. This removes the issue with people easily knowing your key. I don't believe it would matter if someone did however as the key is intended to be public.

Setup Instructions

Upvotes: 1

Related Questions