# Turboku/Heroku: Google JSON Creds

**URL:** <https://community.fly.io/t/turboku-heroku-google-json-creds/3646>\
**Category:** Questions / Help\
**Created:** [January 10, 2022, 2:03pm UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646 "2022-01-10T14:03:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariotrost](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mariotrost](https://community.fly.io/u/mariotrost)\
**Post date:** [January 10, 2022, 2:03pm UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/1 "2022-01-10T14:03:31Z")

</div>

Hi there!

We used Turboku to deploy a Heroku app with fly and almost everything worked seamlessly.

For loading a Google key we [used this solution](https://stackoverflow.com/a/62184769): in a .profile File we print an environment variable into a JSON-File.

Heroku automatically loads .profile files. Is there a way to achieve this with fly?

---

<div class="post-metadata">

**Author:** ![catflydotio](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/catflydotio/32/14559_2.png) [@catflydotio](https://community.fly.io/u/catflydotio)\
**Post date:** [January 10, 2022, 2:13pm UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/2 "2022-01-10T14:13:15Z")

</div>

Hi @mariotrost! I’m not seasoned at this yet, but a sensitive environment variable sounds like it could be a job for [fly secrets](https://fly.io/docs/reference/secrets/).

---

<div class="post-metadata">

**Author:** ![catflydotio](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/catflydotio/32/14559_2.png) [@catflydotio](https://community.fly.io/u/catflydotio)\
**Post date:** [January 10, 2022, 2:53pm UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/3 "2022-01-10T14:53:21Z")

</div>

@mariotrost I’m informed it may not be so simple if you need to get the key into the filesystem before boot. 🙃

---

<div class="post-metadata">

**Author:** ![DazWilkin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dazwilkin/32/18597_2.png) [@DazWilkin](https://community.fly.io/u/DazWilkin)\
**Post date:** [January 11, 2022, 5:09am UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/4 "2022-01-11T05:09:12Z")

</div>

Why can you not use the Google-recommended solution in the other answer in the Stack overflow question that you referenced: [Loading credentials from environment variables](https://github.com/googleapis/google-auth-library-nodejs#user-content-loading-credentials-from-environment-variables)?

Per @catflydotio suggestion, you’d create a secret in Fly with a value of the Service Account’s key, `JSON.parse` the key and then `auth.fromJSON` the result.

---

<div class="post-metadata">

**Author:** ![mariotrost](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mariotrost](https://community.fly.io/u/mariotrost)\
**Post date:** [January 14, 2022, 1:37am UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/5 "2022-01-14T01:37:37Z")

</div>

Thanks for the replies, @DazWilkin you’re totally right: the accepted answer on Stack overflow works for us!

---

<div class="post-metadata">

**Author:** ![DazWilkin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dazwilkin/32/18597_2.png) [@DazWilkin](https://community.fly.io/u/DazWilkin)\
**Post date:** [January 14, 2022, 1:48am UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/6 "2022-01-14T01:48:14Z")

</div>

Excellent!

---

<div class="post-metadata">

**Author:** ![jyasskin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jyasskin/32/48820_2.png) [@jyasskin](https://community.fly.io/u/jyasskin)\
**Post date:** [January 22, 2023, 3:04pm UTC](https://community.fly.io/t/turboku-heroku-google-json-creds/3646/7 "2023-01-22T15:04:53Z")

</div>

For other APIs, there’s often an undocumented `{credentials: parsed_key_json}` argument to the constructor that works instead of the `auth.fromJSON` function.
