title: Initialize Firebase Admin SDK using secret stored in Secret Manager
body: <p>I am trying to initialize the Firebase Admin SDK within a Cloud Run application, using a separate service account (i.e not the default service account).</p>
  <p>The documentation suggests:</p>
  <pre><code>import firebase_admin
  from firebase_admin import credentials
  
  cred = credentials.Certificate(&quot;path/to/serviceAccountKey.json&quot;)
  firebase_admin.initialize_app(cred)
  </code></pre>
  <p>However, I would like to avoid packaging secrets into the Cloud Run container, so I am retrieving the json file from Secret Manager, and trying to create the credentials, and pass it into: firebase_admin.initialize_app(cred)</p>
  <pre><code>import firebase_admin
  from google.cloud import secretmanager
  from google.oauth2 import service_account
  
  # Create credentials object then initialize the firebase admin client
  sec_client = secretmanager.SecretManagerServiceClient()
  name = sec_client.secret_version_path(GOOGLE_CLOUD_PROJECT_NUMBER, FIREBASE_SA_SECRET_NAME, &quot;latest&quot;)
  response = sec_client.access_secret_version(name)
  service_account_info = json.loads(response.payload.data.decode('UTF-8'))
  creds = service_account.Credentials.from_service_account_info(service_account_info)
  firebase_admin.initialize_app(creds)
  </code></pre>
  <p>Error received:</p>
  <blockquote>
  <p>ValueError: Illegal Firebase credential provided. App must be
  initialized with a valid credential instance.</p>
  </blockquote>
  <p>Any tips are appreciated.</p>