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

boxtelp
boxtelp
Community Member

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:cli

Comments

  • andrepereira
    andrepereira
    Community Member

    Yeah I have the same problem, doesn't seem to be supported, given there's no mention in the documentation about it. I suppose you could just use something like this:

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

  • 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

This discussion has been closed.