DEV Community

Discussion on: Google Calendar API Integration Made Easy

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'