Reputation:
I am using heroku environment variables to store oauth2 tokens for authentication with a webhook i've created. As these tokens update, i need to update the environment variables from within the script after i retrieve them.
I've tried the code below, but when i run 'heroku config' from CLI, the old tokens show up.
process.env.GOOGLE_ACCESS_TOKEN = JSON.parse(body).access_token;
Upvotes: 1
Views: 733
Reputation:
Ok, so i figured it out. Just posting here for reference. You can update heroku environment variables using the heroku API. You can get a key via CLI using heroku authorization:create
, and then use that API KEY in a patch call to heroku. More info on how to: https://devcenter.heroku.com/articles/platform-api-reference#config-vars
Upvotes: 2