a-marenkov / gsheets

A Dart library for working with Google Sheets API.
Other
79 stars 31 forks source link

Exception has occurred... When trying to run example. Assistance, please #18

Closed rays-github closed 4 years ago

rays-github commented 4 years ago

Hi, I downloaded the example from this git, and followed instructions to obtain and enter credentials. But Exception has occurred, when trying to run with Visual Studio Code. Might you have suggestions on how to fix? Thanks..

ArgumentError (Invalid argument(s): The given string does not have the correct begin/end markers expected in a PEM file.)

rays-github commented 4 years ago

ok, i might have figured it out. needed to copy and past entire line from credentials: "private_key": "-----BEGIN PRIVATE KEY-----\nPrivateKeyNonsense\n-----END PRIVATE KEY-----\n",

I'm no longer getting the error.

a-marenkov commented 4 years ago

ok, i might have figured it out. needed to copy and past entire line from credentials: "private_key": "-----BEGIN PRIVATE KEY-----\nPrivateKeyNonsense\n-----END PRIVATE KEY-----\n",

I'm no longer getting the error.

Yeah, that was the reason

a-marenkov commented 4 years ago
if (lines.length < 2 || !lines.first.startsWith('-----BEGIN')  || !lines.last.startsWith('-----END')) { 
   throw new ArgumentError('The given string does not have the correct ' 'begin/end markers expected in a PEM file.'); 
}