I'm trying to establish a google oAuth2 client with golang.org/x/oauth2/google
so that I can schedule some email reminders for myself. If I understand the documentation correctly, the rough process goes like this.
- Get an
oauth2.Config
instance - Use the config to get a token from google
- Use token to establish a client
The trouble I'm having is that all of the functions for generating config with golang.org/x/oauth2/google
seem to require a local credential file from which to read what I assume are Google API Client id and Client secrets.
That's fine for a persistent runtime but this application will be running in a volatile location without a disk. I feel like I must be missing some obvious way to create the config using my api client id and secret that I have stored in the environment. Am I using this package incorrectly? How can I create an instance of oauth2.Config
without having a local file?