-
If you are looking for help, please confirm the following...
Which mobile framework are you using?Android (Kotlin) Steps to reproduceI am trying to build an automation system for my white-label app. I am using Codemagic's build API. This is my request:
In my codemagic.yml I have two workflows. One is for publishing to Google Play, other one is for publishing to Firebase.
I have created a service account on google cloud with Firebase App Distribution Admin, and Service Account User permissions. As you can see in the API request I have GCLOUD_SERVICE_ACCOUNT_CREDENTIALS environment variable. I set the service account JSON file encoded with base64 to this variable. With these settings, I can publish to Google Play. But for Firebase I have this error message: I also tried to decode the variable with the following, but no success How do I proceed? I am sure I am missing something. Any help? Expected resultssuccessful build Actual resultsError: Failed to authenticate, have you run Firebase login? Build id (optional)64b6a02f7c9e0bc3b1db1488 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello @keskin Well, the error itself is self-explanatory, most of the times there are just issues with the JSON key. A new generated key always helps. I'm really surprised you have your Google Play Workflow working with that setup, since when I pass base64 encoded GCLOUD Service Credentials, Google Play fails too, as it should. This is surprising and I do not know exactly why your Google Play is working. However, I reproduced it more or less, and got both of the workflows working. I use the same service account for Google Play and Firebase. My API request. I did not include package names, application id-s while testing, since it should not matter. I just hard-coded them into YAML for publishing testing purposes. Request contains the service account JSON key encoded in base64.
Now, to the workflows. When you pass a base64 value, you obviously need to decode it for usage. So I wrote a simple script that decodes the variable. Add this to your scripts before building the app, especially if you are using automatic build versioning.
And everything else should remain the same. My workflow's look like this:
This should answer your question. If you still get any errors, let us know. However, if you can publish to Google Play with this, and Firebase still gives you the "Error: Failed to authenticate, have you run Firebase login?", then you have to check your FIrebase & Google Play and make sure everything is correctly set up with the Service Account integration. Also, try generating a new JSON key for the account. |
Beta Was this translation helpful? Give feedback.
-
@kulakarla Thank you for the answer. I was trying a similar script without considering DELIMETER. With DELIMITER it is working on both Firebase and Google Play. |
Beta Was this translation helpful? Give feedback.
Hello @keskin
Well, the error itself is self-explanatory, most of the times there are just issues with the JSON key. A new generated key always helps.
I'm really surprised you have your Google Play Workflow working with that setup, since when I pass base64 encoded GCLOUD Service Credentials, Google Play fails too, as it should. This is surprising and I do not know exactly why your Google Play is working.
However, I reproduced it more or less, and got both of the workflows working. I use the same service account for Google Play and Firebase.
Here is my setup with explanations:
My API request. I did not include package names, application id-s while testing, since it should not matter. I jus…