0
votes

I am currently using Firebase in iOS app with flutter framework.

The default Google Cloud API key created by firebase has unrestricted access to APIs, so I want to restrict it to certain APIs that my app uses for security reasons.

However, after making API restrictions, almost all firebase related components work fine, but the app does not seem to be able to get Firebase Cloud Messaging Token (e.g. FirebaseMessaging.getToken() call fails). The app suppose to retrieve this token and send it to the backend server such that the server can send FCM messages, but when this call is made, it just hangs for a while and returns null.

When my app key has unrestricted access to APIs, it retrieves FCM token fine, but as soon as I restrict it, it fails to retrieve the token.

I currently have whitelisted following APIs for the Firebase iOS App Key.

  • Identity Toolkit API
  • Token Service API
  • Firebase Remote Config API
  • Firebase Dynamic Links API
  • FCM Registration API
  • Firebase Cloud Messaging API

I have gone through other API list and they do not seem to be related to Firebase Cloud Messaging at all, so I did not select anything else, so I am stuck. Has anyone else encountered this problem when they tried to restrict Firebase API key?

(I am attaching the full API permission list below.)

App Engine Admin API
BigQuery API
BigQuery Storage API
Cloud Build API
Cloud Datastore API
Cloud Debugger API
Cloud Deployment Manager V2 API
Cloud DNS API
Cloud Firestore API
Cloud Functions API
Cloud Logging API
Cloud Messaging
Cloud Monitoring API
Cloud OS Login API
Cloud Pub/Sub API
Cloud Resource Manager API
Cloud Run API
Cloud Runtime Configuration API
Cloud Scheduler API
Cloud Source Repositories API
Cloud SQL
Cloud SQL Admin API
Cloud Storage
Cloud Tasks API
Cloud Testing API
Cloud Trace API
Compute Engine API
Container Registry API
FCM Registration API
Firebase App Distribution API
Firebase Cloud Messaging API
Firebase Dynamic Links API
Firebase Extensions API
Firebase Hosting API
Firebase Installations API
Firebase Management API
Firebase Mods API
Firebase Remote Config API
Firebase Rules API
Google Cloud APIs
Google Cloud Storage JSON API
Google Play Android Developer API
IAM Service Account Credentials API
Identity and Access Management (IAM) API
Identity Toolkit API
Kubernetes Engine API
Legacy Cloud Source Repositories API
Maps Embed API
Maps JavaScript API
Maps SDK for Android
Maps SDK for iOS
Maps Static API
Mobile Crash Reporting API
Service Management API
Service Usage API
Stackdriver API
Street View Publish API
Street View Static API
Token Service API
1

1 Answers

2
votes