Hi,
I'm trying to understand how the CLIENT_ID and API_KEY values are selected from the available ones listed on the Credentials page in GCP, when we download the GoogleService-Info file.
For reference, when we create a new app in the Firebase Console:
- it creates a new OAuth 2.0 Client ID to GCP — "auto created by Google Service"
- it creates a new unrestricted API key — "auto created by Firebase"
When we download the config file, a CLIENT_ID and API_KEY are selected, what is the logic behind that?
From my tests, CLIENT_ID is retrieved from the most recent one that matches the app bundle ID and appstore ID.
I tried to prove this by creating a new Oauth2.0 Client ID with the same bundle ID and appstore ID for the app I then downloaded the config file for, and the newly created Client ID appeared as the value for the config API_KEY, even though there was another identical Client ID in GCP, but just older in date.
For the API_KEY I'm completely at lost, but at config file creation time a decision has to be made on what value to select for API_KEY.
I tried creating a new API key in GCP that is restricted on bundle ID for the app I want to download the config for, but that config always comes back with an already existing API Key — where is that link defined?
I know if I delete, from the GCP Console, the API Key that currently appears on the config file, the new one I created will be picked up, so there is some logic to pick the best match (worst case it creates a new one and picks that).
There seems to be no way to override how the GoogleService file chooses the keys it uses, other than downloading it and then replacing inside the file whatever client id and api key we need. But that kind of defeats the purpose of having the ease of use of just downloading the file.
I couldn't find any docs on this, and nothing on the GCP or Firebase Console that allows defining it.
Any ideas?
Thanks
Rui