DEV Community

Discussion on: Google Calendar API Integration Made Easy

Collapse
 
juniorgodoi profile image
Junior Godoi

Hello, trying this code and getting:

{"error":{"library":"PEM routines","function":"get_name","reason":"no start line","code":"ERR_OSSL_PEM_NO_START_LINE"}}

Can't figure out why, all the settings are correct and calendar is shared with the correct service account.

Collapse
 
ksbeasle profile image
Kahlil Beasley

Hi, don't know if you already figured it out but for you or anyone else running into the same issue I solved it by doing the following.

  1. Put the entire jwt json file you get from google into an env variable in the .env file.
    example: SOME_VAR='{"key": "value"}'
    NOTE The entire json file has to be on a single line

  2. Then read in the value in your index.js file
    example: const { SOME_VAR } = process.env; //JSON

3.Parse it.
example: const someVar = JSON.parse(SOME_VAR);

  1. Use dot notation to access that key and pass it wherever you need it. example: someVar.key // 'value'