# Creating Login For A Node

**URL:** <https://discourse.nodered.org/t/creating-login-for-a-node/17881>\
**Category:** Developing Nodes\
**Created:** [13 November 2019 10:09 UTC](https://discourse.nodered.org/t/creating-login-for-a-node/17881 "2019-11-13T10:09:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akvish](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@akvish](https://discourse.nodered.org/u/akvish)\
**Post date:** [13 November 2019 10:09 UTC](https://discourse.nodered.org/t/creating-login-for-a-node/17881/1 "2019-11-13T10:09:43Z")

</div>

I was trying to create a login mechanism for my node. I followed the below page from official documentation.  
[https://nodered.org/docs/creating-nodes/credentials](https://nodered.org/docs/creating-nodes/credentials)  
But the values are not appearing in the run time. My node is an output category node. From the other nodes available I have seen all of the nodes that uses credential are type of config nodes. Is it must to make the node as config node?  
My code snippet

**Html file**

```auto
<script type="text/x-red" data-template-name="out node">
	....................
       .......................
	<div class="form-row">
        <label for="node-config-input-user"><i class="fa fa-user"></i> User name</label>
        <input type="text" id="node-config-input-user" placeholder="user">
	</div>
	<div class="form-row">
        <label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
        <input type="password" id="node-config-input-password" placeholder="password">
    </div>
    ......................
    .......................
</script>

```

```auto
<script type="text/javascript">
	RED.nodes.registerType('out node', {
		category: 'output',
		defaults: {
			.............................
		        .............................
		},
		credentials: {
            user: {type: "text"},
            password: {type: "password"}
        },
		color: .......................,
		.....................................
		label: function() {..............
         }
		oneditprepare: function() {...........
        });

```

**js file**

```auto

 module.exports = function (RED) {
    "use strict";
function OutNode(config) {
        var node = this;
        var statusVal;
        RED.nodes.createNode(this, config);
        console.log("this " + JSON.stringify(this));
        console.log("config " + JSON.stringify(config));
        console.log("node " + JSON.stringify(node));
        var credentials = this.credentials;
        console.log("Credentials " + JSON.stringify(credentials));
        user = "";
        password = "";
        if(credentials){
            var user = credentials.user;
            var password = credentials.password;
        }
        console.log("User " + user);
        console.log("Password " + password)
       ..........................................................
       ..........................................................
   },
  RED.nodes.registerType("out node",OutNode,{
            credentials: {
            user: {type:"text"},
            password: {type:"password"}
        }
    });
};

```

In console output I am getting an credentials as empty.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 November 2019 10:39 UTC](https://discourse.nodered.org/t/creating-login-for-a-node/17881/2 "2019-11-13T10:39:03Z")

</div>

> [@akvish](#):
>
> node-config-input-user

As you are not creating a Configuration node, then the `id` fields in the html should be `node-input-user` and `node-input-password`.

---

<div class="post-metadata">

**Author:** ![akvish](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@akvish](https://discourse.nodered.org/u/akvish)\
**Post date:** [14 November 2019 11:24 UTC](https://discourse.nodered.org/t/creating-login-for-a-node/17881/3 "2019-11-14T11:24:31Z")

</div>

Thanks 🙂 Now it works fine.
