Skip to main content
April 29, 2022
Question

Using the CLI, how can I get an OTP value in a template (tpl)?

  • April 29, 2022
  • 2 replies
  • 133 views

If I just refer to an item, like "{{ op://Vault/my_item/one-time password }}", it outputs the 32 char string that generates the value. However, I don't need that string, I need the value that's generated. How do I get it?


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Referrer: forum-search:https://1password.community/search?Search=cli%20

2 replies

May 6, 2022

Yeah I have the same problem, doesn't seem to be supported, given there's https://developer.1password.com/docs/cli/secrets-environment-variables/ in the documentation about it. I suppose you could just use something like this:

export SOME_VAR=$(op item get <item> --otp)

May 10, 2022

Hey all,

Indeed, this is currently not natively supported, and the workaround that @andrepereira proposes is the cleanest way to achieve this, at the moment. However, adding an alternative for fetching different field attributes (other than the value) with secret references is on our short roadmap, so stay tuned for the next releases!

Best,
Horia