Skip to content

Cannot set the Password field when creating new Items #108

Open
@IAreKyleW00t

Description

@IAreKyleW00t

Your environment

SDK Version: 1.4.0

Connect Server Version: 1.7.2

OS: Ubuntu 22.04.3 LTS (Jammy Jellyfish) (WSL2)

Node Version: 18.18.2

Context: Building a Backstage plugin for interacting with 1Password via Scaffolding actions.

What happened?

There is no way to set the username or password fields when creating a new Item. Attempting to include a field to set the password results in a similar field with the same name (but not the actual password field) being made, or it being completely ignored. In both cases the password remains blank. This is with the ItemBuilder and by manually creating an object with the necessary details (see below).

This appears to be the case for all "special" fields in across all Items, but I'm specifically using the "Login" item for my use-case.

What did you expect to happen?

I expect to be able to set the password (and any other fields) at creation time, as well as being able to effectively update these.

Steps to reproduce

  1. Create an item using the ItemBuilder as described in the documentation.
  2. Try to use ItemBuilder.addField() to add fields for Password, Username, etc.
  3. There is no option to set the password, username, or notesPlain - adding fields with similar labels/configurations are treated as separate fields with similar labels.
  4. Use ItemBuilder to build Item without any fields. Instead, manually create each FullItemAllOfFields and add it the built FullItem object (including a password field, as seen below).
  5. Use op.createItem() with the newly built Item with manual fields.
  6. New item is created in 1Password, but the password field that was manually put in is completely ignored. New item has everything except the password field, which is blank in 1Password.

Notes & Logs

Example Input

This is what is sent to the op.createItem() function.

{
  "fields": [
    {
      "section": {
        "id": "Section_SomeRandomSectionID",
        "label": "test section"
      },
      "type": "String",
      "label": "some label",
      "value": "static value!",
      "recipe": {}
    },
    {
      "id": "password",
      "type": "Concealed",
      "purpose": "Password",
      "label": "password",
      "generate": true,
      "recipe": { "length": 20, "characterSets": ["Letters", "Digits"] }
    }
  ],
  "tags": [],
  "title": "Test Item",
  "category": "LOGIN",
  "sections": [
    { "id": "Section_SomeRandomSectionID", "label": "test section" }
  ],
  "urls": [{ "href": "https://example.com/, Opens in a new window" }]
}

Output

This is the FullItem response from the op.createItem().

{
  "id": "SomeUniqueAndRandomItemId",
  "title": "Test Item",
  "vault": { "id": "REDACTED" },
  "category": "LOGIN",
  "urls": [{ "href": "https://example.com/" }],
  "createdAt": "2023-11-13T16:33:08.305Z",
  "updatedAt": "2023-11-13T16:33:08.305Z",
  "sections": [
    {
      "id": "Section_SomeRandomSectionID",
      "label": "test section"
    }
  ],
  "fields": [
    {
      "id": "username",
      "type": "STRING",
      "purpose": "USERNAME",
      "label": "username"
    },
    {
      "id": "password",
      "type": "CONCEALED",
      "purpose": "PASSWORD",
      "label": "password"
    },
    {
      "id": "notesPlain",
      "type": "STRING",
      "purpose": "NOTES",
      "label": "notesPlain"
    },
    {
      "id": "SomeUniqueAndRandomFieldId",
      "section": { "id": "Section_SomeRandomSectionID" },
      "type": "STRING",
      "label": "some label",
      "value": "static value!"
    }
  ]
}

Thanks, and appreciate any other guidance on this as well! 😸

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions