Our community is getting an upgrade on July 2nd! Learn more in the FAQs →
Forum Discussion
planetf1
1 year agoOccasional Contributor
1password cli caching (vscode)
I have a credential I need to set in an environment (.env) for Python before running a program.
This is all defined via vscode tasks. I switch between 'groups' of settings (ie multiple environment variables) by just copying a template to the .env file
An example of one credential is:
export GITHUB_PERSONAL_ACCESS_TOKEN=$(op --cache read --account https://my.ent.1password.com/ "op://Private/Github API token/password")
When my python code is run (which loads .env) I get prompted for biometrics. That's fine, except that there is no caching ie I get prompted every time.
The process being run is of course different each time.
Note : I initially didn't have --cache specified, and have subsequently added it after seeing it mentioned here.
Any suggestions on how to cache these approvals/credentials for a short while (my intent is not to materialise the actual password in a file at any point). Do I need to write my own helper process, or is there something suitable available in the api?
3 Replies
- theoOccasional Contributor
the problem is that op's "session" logic is purely based on TTY id. So when you do things outside of a terminal session, it always assumes it's a new one.
Varlock may help solve your problems, both due to caching, and it's flexible session logic. See https://www.1password.community/discussions/developers/device-encrypted-caching-for-op---fewer-round-trips-no-unlock-prompt-storms/171229
- planetf1Occasional Contributor
Anyone have any ideas on this? I'd like to use the cli more in this environment, but having to auth on seemingly every request is a step too far
- planetf1Occasional Contributor
1Password for Mac 8.10.76 (81076032)
CLI : 2.31.0