Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the purpose of other_platform_oauth_client in google-services.json?

Tags:

firebase

I re-downloaded the google-services.json file for Android from the Firebase console and found that there is suddenly an additional field:

"services": {
    "appinvite_service": {
        "other_platform_oauth_client": [
          {
            "client_id": "xxx.apps.googleusercontent.com",
            "client_type": 2,
            "ios_info": {
              "bundle_id": "com.xxx.xxx",
              "app_store_id": "xxx"
            }
          }
        ]
    }
}

The project has an iOS and Android client, so this entry for Android apparently reference the iOS client.

What is the purpose of that entry?

like image 420
Manuel Avatar asked Nov 01 '19 18:11

Manuel


People also ask

What is the purpose of the generated Google services JSON file?

The google-services. json file created in this doc is used within your app to connect to firebase and facilitate Android Push Notifications and is normally labelled google-services.

How can I add two Google services json in the same project?

There is no way to use two google-services. json files in a single Android app. The file name is the same between them and they need to be in the same location. So one will overwrite the other in that case.


1 Answers

The purpose:

The client_id (together with client_type) are references to credentials that have been created and accessible to you and your project via the Google Developer Console (https://console.developers.google.com/apis/credentials). These can be used when your app needs more than just an app side interaction with Google Services.

Some examples:

  • When you enable OAuth 2.0 to use with your app, as a developer (or console admin) you create one or more new credential entries for the platforms (Android, iOS, web, etc.) that you support. As a result client IDs are generated by Google Developer Console for those credentials. Depending on the needs of your app, you might want to use this client ID, when sending a login request to Google (Google Sign-In), so that later you can authenticate the user with your server before allowing (or denying) user access to your app. More info on this example: https://developers.google.com/identity/sign-in/android/offline-access

  • Google Services automatically creates the client IDs and the required credentials in Google Console when setting up certain services (e.g. Firebase, Admob, or Other related services).

I hope this answer does explain the purpose of those values.

like image 183
Armin Avatar answered Sep 20 '22 08:09

Armin