Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    How do I store a file with GOOGLE_APPLICATION_CREDENTIALS needed for Firebase Auth?

    Cloud Backend (Cloud DB, API Builder)
    2
    2
    397
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ugnius Ramanauskas
      Ugnius Ramanauskas last edited by

      Hey. Would anyone know how I could upload and use GOOGLE_APPLICATION_CREDENTIALS json file as an Environment variable?

      As described here: https://firebase.google.com/docs/admin/setup#node.js_1
      e.g.
      GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"

      1 Reply Last reply Reply Quote 0
      • Joseph Benguira
        Joseph Benguira last edited by

        Hey Ugnius,

        in the env variable settings, add a new env var, name it "googleJSON" for eg. but you can name it as you want
        on the right side, as value, paste the whole text content of the json file you have from google.

        var googleJSON = JSON.parse(process.env.googleJSON);

        admin.initializeApp({
        credential: admin.credential.cert({
        projectId: googleJSON.project_id,
        clientEmail: googleJSON.client_email,
        privateKey: googleJSON.private_key
        }),
        databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
        });

        Just a small thing, whenever you can you should avoid Google!
        Google deprecates API and services every week and providing nearly zero warning to "customers", in fact they have no respect at all for developers using their services and it's nearly impossible to talk with someone there. So if you want your service to be down in the next 6 months because it's deprecated without any notice ... sure go with google 🙂

        1 Reply Last reply Reply Quote 1
        • First post
          Last post