Forum Discussion

Former Member's avatar
Former Member
3 years ago

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

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

  • Former Member's avatar
    Former Member

    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

  • Former Member's avatar
    Former Member

    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)