-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
README Properties Service key retrieval error #161
Comments
When saving the key manually.. are you adding the escape characters for the newline? You should probably play with that, and don't use |
So I tried escaping the newline characters but there's no way around it, it seems because the key/value has to be valid json and there's no way of encoding newline characters in it. The only way around it with manual setting that I found was using the |
You seem to be having an isolated issue. I tried my best to provide as close to literal example in the README. I'm fine to help you with ideas if you can debug what you are sending and retreiving from the Property Service. |
This comment gives an actual clean way of extracting credentials from the JSON of the service account while avoiding that issue. I've implemented it for myself. If you don't use service account for Oauth then the workaround with function getOAuthCreds() {
try {
const scriptProperties = PropertiesService.getScriptProperties();
return JSON.parse(scriptProperties.getProperty('SERVICE_ACCOUNT_CREDS'));
} catch (err) {
// TODO (developer) - Handle exception
return null;
}
} Then retrieve the private key, email etc with the returned object: getOAuthCreds().private_key |
Is your feature request related to a problem?
In
README.md#configuration-template
when talking about usingProperties Service
to retrieve the configuration data, specifically theprivate_key
.If the key is set programatically through
PropertiesService.getScriptProperties().setProperty()
there is no issue.But if the key is set manually through the script settings then it gives an error on retrieval.
This is related to this issue where newline characters aren't correctly converted and has to be done manually upon retrieval.
For example
Describe the solution you'd like
To clarify this in the documentation to avoid confusion when setting the private_key in this way.
The text was updated successfully, but these errors were encountered: