Search code examples
google-cloud-platformgoogle-authentication

Get Google Project ID from Client ID + Secret?


I've got a Client ID and Client Secret for some Google-based authentication in a Django app. How do I use this information to get the actual Google project name/ID that is being used?

Using an API would be great but I'm down for clicking through a bit of web UI too.

P.S. -- I am unsure how to tag/categorize this question so I appreciate any help there.


Solution

  • My co-worker pointed out the obvious answer. Here's an example client ID:

    GOOGLEAUTH_CLIENT_ID=1234567890-aksjfljsalfjslfjlksf.apps.googleusercontent.com
    

    The digits preceding the first hyphen are the Google Cloud Project Number. Voila! No API call required. face smash

    The Number can be used to look up the ID using gcloud projects list:

    PROJECT_ID             NAME       PROJECT_NUMBER
    example-river-417      Example    1234567890
    asdfjkl                Example2   1234567891