This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
You can use the code below in Cloudfalre worker environment to generate a Google access token | |
for a service-account. | |
Run this code in a worker cron so you always have a fresh token in your KV that can be used by other workers. | |
The generated token here will be valid for 3600 seconds, but you can change that in your code. | |
The code assumes that you have a KV mapped to 'PROPERTIES' in you wrangler.toml file | |
You must create a service-user and assign to it the roles that you need in google console. | |
Then take the JSON that you get and paste it below |