Recently, we made the service account key and saw a box that said
Service account keys could pose a security risk if compromised. We recommend that you avoid downloading service account keys and instead use the Workload Identity Federation. You can learn more about the best way to authenticate service accounts on Google Cloud here.
I am using the firebase admin sdk version 6.8.1 to send clouding message, now we are using workload identity federation instead of the service account key json file:
InputStream serviceAccount = new ClassPathResource(workloadCredential).getInputStream();
FirebaseOptions options = new FirebaseOptions.Builder().setProjectId(projectIdsMap.get(pline))
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl(databaseUrl).build();
FirebaseApp firebaseApp = FirebaseApp.initializeApp(options, pline);
But we got the following error:
{
"error": {
"code": 500,
"message": "Authentication backend unknown error.",
"status": "UNKNOWN"
}
}
So does the Firebase Admin SDK support workload identity federation? Is there any other way to handle the situation?
I tried and got the above
Frotly Song is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.