Giter VIP home page Giter VIP logo

Comments (10)

grahamearley avatar grahamearley commented on July 26, 2024 100

Interesting... Well feel free to re-open if you still have issues. Also Weezer rocks.

from firestoregoogleappsscript.

riverscuomo avatar riverscuomo commented on July 26, 2024 43

Awesome. This library rocks.

I've been having other problems with Google Apps Scripts in the last 24 hours. Namely, they suddenly haven't been able to find some of my functions and I've had to move them around in the Files browser panel. I'll let you know if I learn anything.

from firestoregoogleappsscript.

3zzy avatar 3zzy commented on July 26, 2024 2

This seems to resolve the issue:
props.getProperty('private_key').replace(/\\n/g, '\n')

... but not sure if this is the best way to fix it.🤷

from firestoregoogleappsscript.

elmarti avatar elmarti commented on July 26, 2024 2

@3zzy @riverscuomo Say it ain't so! It seems the script properties escapes the field input, I got around this by storing the whole service account JSON object as a property i.e:

const serviceAccount = JSON.parse(PropertiesService.getScriptProperties().getProperty("service_account"));
const key = serviceAccount.private_key;
const clientEmail = serviceAccount.client_email;  

from firestoregoogleappsscript.

3zzy avatar 3zzy commented on July 26, 2024 2

Doesn’t help when you quote ;)

I’ll just regenerate the key.

from firestoregoogleappsscript.

LaughDonor avatar LaughDonor commented on July 26, 2024 1

As listed in the Configuration Template, you should ensure your key matches the format literally (improperly formatted newlines are a common issue).

I figure adding some validation to check this would help the adoption rate of this library.

from firestoregoogleappsscript.

grahamearley avatar grahamearley commented on July 26, 2024

I went ahead and created a new Service account and downloaded a new key.

Did this have any impact on the issue? Nothing has changed for the past year or so in the repo, so I think this must be a configuration issue. Any idea what you might have messed up in Firebase?

from firestoregoogleappsscript.

riverscuomo avatar riverscuomo commented on July 26, 2024

Thanks for the response. I'll close this now because when I hard code the serviceEmail, private_key, and project_id into my script it works fine. There must be some problem with Script Properties (even though they have the same 3 values.)

Any idea what you might have messed up in Firebase?

I accidentally deleted an Android app in the same project. I guess that wouldn't have any effect on this Google Apps Script.

from firestoregoogleappsscript.

jamesarosen avatar jamesarosen commented on July 26, 2024

Utilities.computeRsaSha256Signature requires that the key be a valid PEM string. That is, it should look like

-----BEGIN PRIVATE KEY-----
privatekeyhere
-----END PRIVATE KEY-----

There must be some problem with Script Properties

I think you're on the right track with this. It seems like the key you're getting is not a PEM (and very possibly null/undefined).

from firestoregoogleappsscript.

epistemologist avatar epistemologist commented on July 26, 2024
Screen Shot 2022-09-04 at 10 35 30 am

I'm having the same issue although I can log the key fine. thinking

This is easily enough information to fully recover the private key - see this post for an example. I highly recommend changing the image to something else.

from firestoregoogleappsscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.