Closed jooj123 closed 6 years ago
Hi. Looks like you generated wrong client secret. Format of secret key has to be like this https://github.com/paulirish/pwmetrics/blob/v3.2.0/types/types.ts#L90
Does it mean just grabbing this object and putting it into pwmetrics-config.js clientSecret property ?
Yes it is)
Here's format of mine
clientSecret:
{
"installed": {
"client_id": "id",
"project_id": "pwmetrcis",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "key",
"redirect_uris": [
"url",
"http://localhost"
]
}
}
@denar90 this format works
Seems its not clear from the docs so thats where the confusion lies - Ill throw up a PR
Cool 👍 I'd like to merge your PR ;)
Pretty sure this is a bug
In the google sheets setup here: https://github.com/paulirish/pwmetrics#defining-submit
It says "Take a client_secret and put it into the config as value of clientSecret property." - not sure what this means exactly. I have downloaded the JSON file from google sheets api setup - thats in the format:
Does it mean just grabbing this object and putting it into
pwmetrics-config.js
clientSecret
property ?I have tried this with example config here:
But this doesnt work - I get error:
Seems that the code here: https://github.com/paulirish/pwmetrics/blob/1f70ee3137a157186de4ef0b56f4bd8c94524a3e/lib/oauth/google-oauth.ts#L45
Seems incorrect as it checks for an "installed" property ? I can fix this up but not sure if this property is there for a reason?
Also seems you need to configure a redirect uri in order for oauth. Is there any way to setup with a service account so that this manual step is not required? I would like for this sheets api integration to be part of CI - I can see there is an example to integrate puppeteer to do the login but this seems a bit clunky: https://github.com/google/google-auth-library-nodejs/pull/265