API key used for Firebase in iOS clients sometimes unintentionally changes

There have been a few times now that the API key we use in our iOS clients to register with Firebase Cloud Messaging has unintentionally changed. I contacted Firebase Support about this and was put on the trail of Cloud Audit Logs to find out why the API key changed. I managed to find a log which uses the method "google.api.apikeys.v2.ApiKeys.UpdateKey". This log only references a resource that I cannot find anywhere in our Google Cloud project. The resource is displayed in the following format: "projects/{project-id}/locations/global/keys/{UUID}". How can I find out which API key has been changed in this log entry? And is this the right log at all?

Also, I cannot find the API keys used by our iOS clients in the GoogleService-Info.plist file in the Google Cloud project. Should this be the case? And if so, where can I find these keys?

Solved Solved
1 1 640
1 ACCEPTED SOLUTION

Hi @sociedeveloper ,

- In order to find out changes/creation details for API keys, Cloud Audit logs is where I would start too.
- For locating API keys, you are right, they should be in GoogleService-Info.plist file. Reference: https://firebase.google.com/docs/projects/api-keys
- You can list the api keys in a project by using the following gcloud command: https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list
Or you can visit the "Google Cloud Console>APIs & Services> Credentials" section in a project to view the existing API keys.
- Lastly, if you are noticing a pattern of API key changes within this project, you may want to follow the steps here to secure the API keys: https://cloud.google.com/api-keys/docs/overview#securing_an_api_key

Hope this helps.


Kind Regards,

Sanket K

View solution in original post

1 REPLY 1

Hi @sociedeveloper ,

- In order to find out changes/creation details for API keys, Cloud Audit logs is where I would start too.
- For locating API keys, you are right, they should be in GoogleService-Info.plist file. Reference: https://firebase.google.com/docs/projects/api-keys
- You can list the api keys in a project by using the following gcloud command: https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list
Or you can visit the "Google Cloud Console>APIs & Services> Credentials" section in a project to view the existing API keys.
- Lastly, if you are noticing a pattern of API key changes within this project, you may want to follow the steps here to secure the API keys: https://cloud.google.com/api-keys/docs/overview#securing_an_api_key

Hope this helps.


Kind Regards,

Sanket K

Top Labels in this Space