# Credentials with required input fields

**URL:** <https://discourse.nodered.org/t/credentials-with-required-input-fields/95503>\
**Category:** Developing Nodes\
**Created:** [19 February 2025 03:28 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503 "2025-02-19T03:28:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrilcode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vrilcode/32/99050_2.png) [@vrilcode](https://discourse.nodered.org/u/vrilcode)\
**Post date:** [19 February 2025 03:28 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/1 "2025-02-19T03:28:29Z")

</div>

Hi,

I have create a config node for another node and it has credential input fields. How can I make those fields required? With normal input fields, I would set required: true in defaults of RED.nodes.registerType, but what about credential input fields. Docs mention, that the only property is type, which can be "text" or "password", but it seems there is no required-property. Any hints?

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [19 February 2025 08:03 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/2 "2025-02-19T08:03:59Z")

</div>

Same as default, `type` has a different meaning between the `credentials` and `defaults` properties.

```auto
RED.nodes.registerType("your-type", {
  credentials: {
    yourCred: { type: "text", required: true },
  },
  defaults: {
    name: { value: "" },
    config: { type: "mqtt-broker" },
  },
}

```

---

<div class="post-metadata">

**Author:** ![vrilcode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vrilcode/32/99050_2.png) [@vrilcode](https://discourse.nodered.org/u/vrilcode)\
**Post date:** [19 February 2025 12:12 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/3 "2025-02-19T12:12:36Z")

</div>

Thank you! So it's the same like non-credential input fields?  
When I read the docs - [Node credentials : Node-RED](https://nodered.org/docs/creating-nodes/credentials) - and it says "The entries take a single option - their `type` which can be either `text` or `password`" I thought only "type" property is possible.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [19 February 2025 13:59 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/4 "2025-02-19T13:59:38Z")

</div>

Yeah, the documentation is unfortunately not up to date.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [19 February 2025 16:38 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/5 "2025-02-19T16:38:12Z")

</div>

I made a small update:

> <https://github.com/node-red/node-red.github.io/pull/378>
>
> Ref: https://discourse.nodered.org/t/credentials-with-required-input-fields/9550…3.
> 
> \- \`credentials\`
> - The definition of a credential does not only contain \`type\`.
> \- \`properties\`
> - Added \`label\` to node property definitions.
> - Complete the list of reserved property names.
> - Updated the definition and examples of \`validate\` property.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 March 2025 16:38 UTC](https://discourse.nodered.org/t/credentials-with-required-input-fields/95503/6 "2025-03-05T16:38:45Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
