OTP in new login item

mattwas
mattwas
Community Member

I'm automating the creation of new login items that have a one time password. The script has the URI for the OTP, but I can't figure out how to add it to the login item.

This is what I have - where does the OTP go?

json_string='{"notesPlain": "Save these credentials to your own vault.", "fields": [{"value": "'"$user"'","name": "username","type": "T","designation": "username"},{"value": "temp1234","name": "password","type": "P","designation": "password"}]}'

op create item login $(echo $json_string | op encode) --title=TITLE --vault=$vault_name

Thanks


1Password Version: 0.5.5
Extension Version: Not Provided
OS Version: MacOS 10.14.4
Sync Type: Not Provided

Comments

  • cohix
    cohix
    1Password Alumni

    @mattwas you'll want to add a new section with an OTP field in it. A good tip for anything related to items in the CLI is to create the item that you want using one of our apps, then use op get item to see what the JSON of that item looks like. For an OTP, here's an example section:

    "sections": [
          {
            "fields": [
              {
                "k": "concealed",
                "n": "TOTP_{random uppercase alphanumeric string}",
                "t": "One-Time Password",
                "v": "{totp secret here}"
              }
            ],
            "name": "Section_{another random uppercase alphanumeric string",
            "title": "{whatever you want, such as "2FA"}"
          },
    
This discussion has been closed.