Correct way to put credentials.json directly into .env variable · Issue #68 · kreait/laravel 您所在的位置:网站首页 1a2b3c4d5e6f7g8h9i Correct way to put credentials.json directly into .env variable · Issue #68 · kreait/laravel

Correct way to put credentials.json directly into .env variable · Issue #68 · kreait/laravel

#Correct way to put credentials.json directly into .env variable · Issue #68 · kreait/laravel| 来源: 网络整理| 查看: 265

This excellent package works great for me when referencing the credentials via file in the .env file. However, we use Heroku for staging/production and only have access to string environment variables.

Following this closed issue #63

I used JQ to minify my file, and then placed it into the .env like this:

FIREBASE_CREDENTIALS={"type":"service_account","project_id" ...

This works without the private key, but with the full json which includes '"private_key":"-----BEGIN PRIVATE KEY-----\n' it throws the following laravel application error: "Failed to parse dotenv file due to unexpected whitespace."

If i enclose the entire thing in apostrophes like this:

FIREBASE_CREDENTIALS='{"type":"service_account","project_id" ... '

I get the following error: "Invalid service account: json_decode error: Control character error, possibly incorrectly encoded"

If i remove the apostrophes so the json can correctly decode, and then attempt to change the private key at all - escaping the spaces or anything like this:

FIREBASE_CREDENTIALS={"type":"service_account","private_key":"-----BEGIN\ PRIVATE\ KEY-----\

i get the following error response when trying to use the service: "openssl_sign(): supplied key param cannot be coerced into a private key",…}"

What is the correct format for the FIREBASE_CREDENTIALS variable?

Thanks in advance!!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有