# Alternate auth sources for httpNodeAuth

**URL:** https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039
**Category:** Dashboard
**Created:** [15 March 2019 22:42 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039 "2019-03-15T22:42:06Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![joshuarestivo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joshuarestivo/32/6823_2.png) [@joshuarestivo](https://discourse.nodered.org/u/joshuarestivo)
#### Post date: [15 March 2019 22:42 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/1 "2019-03-15T22:42:06Z")

</div>

Is there a way to use twitter or any other OAuth provider with httpNodeAuth. Ultimately, I'm trying to control access to dashboard (/ui) resources using something other than a static UN/PW.

thanks,  
-j

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [15 March 2019 22:46 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/2 "2019-03-15T22:46:39Z")

</div>

In the docs:

[https://nodered.org/docs/security#oauthopenid-based-authentication](https://nodered.org/docs/security#oauthopenid-based-authentication)

---

<div class="post-metadata">

### Author: ![joshuarestivo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joshuarestivo/32/6823_2.png) [@joshuarestivo](https://discourse.nodered.org/u/joshuarestivo)
#### Post date: [16 March 2019 13:41 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/3 "2019-03-16T13:41:28Z")

</div>

Not really. That's for adminAuth, not httpNodeAuth. All the docs says about httpNodeAuth is, "The routes exposed by the HTTP In nodes can be secured using basic authentication." I tried using an adminAuth OAuth config with httpNodeAuth but node red fails to start.

I should add that when adminAuth is enabled, the dashboard resource (/ui) is not protected.

---

<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: [16 March 2019 14:06 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/4 "2019-03-16T14:06:02Z")

</div>

We only support basic auth for httpNodeAuth.

A better login story for the dashboard has been a long standing to-do item.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [16 March 2019 14:53 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/5 "2019-03-16T14:53:20Z")

</div>

Does the middleware work for this? From `settings.js`

```auto
    // The following property can be used to add a custom middleware function
    // in front of all http in nodes. This allows custom authentication to be
    // applied to all http in nodes, or any other sort of common request processing.
    //httpNodeMiddleware: function(req,res,next) {
    // // Handle/reject the request, or pass it on to the http in node by calling next();
    // // Optionally skip our rawBodyParser by setting this to true;
    // //req.skipRawBodyParser = true;
    // next();
    //},

```

---

<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: [16 March 2019 17:09 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/6 "2019-03-16T17:09:42Z")

</div>

No, that only applies to the HTTP In nodes

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [16 March 2019 17:10 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/7 "2019-03-16T17:10:27Z")

</div>

Ah, OK. For some reason I never seem to be able to remember that - creeping old age probably ☹

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [7 May 2019 16:09 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/8 "2019-05-07T16:09:52Z")

</div>

in the master tree I have finally merged that outstanding PR #209 to allow express middleware to be added to the dashboard - that is different to the default http middleware. set by `ui: { middleware: your_function... },` in settings.js

---

<div class="post-metadata">

### Author: ![bryan-ninjamoba](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bryan-ninjamoba/32/21973_2.png) [@bryan-ninjamoba](https://discourse.nodered.org/u/bryan-ninjamoba)
#### Post date: [13 May 2019 08:05 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/9 "2019-05-13T08:05:54Z")

</div>

Is there a way to address this issue from node-red flows? For instance to allow IBM api management and App-ID access.

---

<div class="post-metadata">

### Author: ![BryanOgd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bryanogd/32/10187_2.png) [@BryanOgd](https://discourse.nodered.org/u/BryanOgd)
#### Post date: [17 July 2019 14:45 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/10 "2019-07-17T14:45:44Z")

</div>

Can you suggest a link to impliment this addition of middleware please.. I appreciate the clue but have only a vauge idea of what to search for or where to get a recipie, I've been researching a way to impliment oauth for the dashboard or mui for 3 months it's become a part time job.. so any help appreciated.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 July 2019 23:00 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/11 "2019-07-17T23:00:30Z")

</div>

Not done this myself. However, you should be able to use PassportJS to achieve it. You will need to research how to use PassportJS as ExpressJS middleware. ExpressJS middleware is simply an async function that must end by either returning a response to the browser client or returning `next()` which passes control along to the next middleware function in the chain.

In essence, you do some processing in the middleware function that results in a response to the client or returning `next()` if everything was successful or `next(err)` (or whatever your error object is called) if you want to pass along an error to be eventually handled by the Express error handling function.

There is a partial example here:

> <https://github.com/node-red/node-red-dashboard/pull/209/>

---

<div class="post-metadata">

### Author: ![CreativeWarlock](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/creativewarlock/32/102051_2.png) [@CreativeWarlock](https://discourse.nodered.org/u/CreativeWarlock)
#### Post date: [21 November 2020 10:50 UTC](https://discourse.nodered.org/t/alternate-auth-sources-for-httpnodeauth/9039/12 "2020-11-21T10:50:15Z")

</div>

That node seems promising:

> **[SenseTecnic/node-red-contrib-users](https://github.com/SenseTecnic/node-red-contrib-users)**
>
> A node used to quickly build a simple user system to control access to your http nodes on Node-RED. - SenseTecnic/node-red-contrib-users

However, the developers didn't implement it in a way to work with a UI dashboard - yet.  
(I've asked on their GitHub project if there is an update to be expected.)
