How can I have 2 websites added to a login item via CLI?

Options
bfreeman
bfreeman
Community Member

I am trying to automate adding logins to a vault via a linux server. I am creating a template command using op item create.

Here is my template:
op item create --category=login --title='Template' --vault='example' username='example' password='example' 'Example domain[url]=https://example.example.com' 'Example domain 2[url]=https://example.com' 'id string[text]=example'

This is the way that I found how to get both URLs in the record, but I am finding that because these URLs are not in the website field that comes with the login category, I am not getting autofill suggestions for either URL.

I am able to get just one of these URLs into the right field if I use --url as I have in the following example.

op item create --category=login --title='Template' --vault='example' --url 'https://example.com' username='example' password='example' 'Example domain[url]=https://example.example.com' 'id string[text]=example'
but only the URL added via --url is able to be autofilled.

Is there a way to pass 2 different URLs into the record with op item create so that the record can be autofilled on either URL?

I know that this can be done by clicking on the '+ add another website' button in the app, but since the command would be run on a linux server, it is not able to click on this button in the 1Password 8 app. Any help with this is greatly appreciated. Thank you!


1Password Version: CLI 2.19.0
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

Comments

  • cmjd
    cmjd
    Community Member
    edited August 2023
    Options

    I also have this same question. I saw a post from March 20 by Maciejf85 that mentioned the beta of the CLI had --autofill-urls flag and you could pass multiple websites that way, but that no longer seems to work. For reference, that post showed something like:

    op item create ..... --autofill-urls "https://google.com,website2=https://yahoo.com"

    PLEASE let us know how we can do this and it would be fantastic if it got into the documentation with an example. Thanks!

  • Hey!

    The example @cmjd shared should work. op item create --category=Login --autofill-url "website1[primary]=test.com,website2=test2.com" - this works for me with the latest version of the CLI (v2.19.0).

    If this doesn't work, can you describe the behaviour you see?

    Thanks!
    Amanda

  • cmjd
    cmjd
    Community Member
    edited August 2023
    Options

    Hi - thanks for the reply. I just tried that again. The screenshot shows I'm on version 2.19.0 of the CLI and the error says that the parameter --autofill-url isn't recognized. I also tried it plural as --autofill-urls just to be sure, and that generates the same error. I'm running this on a Linux server, if that matters. I also tried it on a Mac laptop locally, and I get the same error indicating it doesn't recognize the --autofill-url parameter.

  • bfreeman
    bfreeman
    Community Member
    edited August 2023
    Options

    Hey @1P_Amanda!

    I did try out the command you sent on CLI v2.19.0 and I got this error in the CLI.

    I then saw @cmjd's suggestion of trying the beta version and I did get that same command to work on the beta CLI v2.19.0-beta.01

    It made it to the app!

    This does help me with my problem. The only issue I have is that this feature is in the beta version. Do you have an idea when it might make it to a stable release?

  • cmjd
    cmjd
    Community Member
    edited August 2023
    Options

    @1P_Amanda - Ah, so the 2.19.0-beta.01 has this functionality, but it was not included in the production release version of 2.19.0.

    I guess my question, then, is are there plans to release this functionality in a production release of the CLI since it wasn't in the formal 2.19.0 release? We'd rather not run a beta release of software on our sever...

  • Yes, we have plans to add it to a production release of the CLI, but unfortunately I can't share a timeline for it. Thank you for the reminder!

This discussion has been closed.