Custom Authentication using Cookie

We have a documentation on Custom User Authentication:
https://nodered.org/docs/security#custom-user-authentication

But I need little bit more. I have a React site with:

  • A custom username and a password field validator (HTML form).
  • Integrated IFrame of NodeRED.

After react validation success, I get JWT token. So when I login to the React site, I don't need this NodeRED dialogue form for re-entering the username and password. I want to use that JWT token for the validation. How can I achieve this functionality?

Not sure how, but there is jwt authorization node node-red-contrib-auth it might help you, and
image

That is just a Node of NodeRED. But I want to replace that authentication dialogue box with my JWT token of WebApp.

Don't wanna see this, when I have JWT token in my WebApp.

@RaiBnod but this is admin interface login, dont you want /ui authorized with JWT ?

Just want to do admin interface login via my own JWT token (I have JWT token in my WebApp not in NodeRED).

Hi @RaiBnod

the Node-RED auth system doesn't allow you to use your own token.

You would need to do something along the lines of:

  1. once a user has logged into your application, obtain a valid access token for them - https://nodered.org/docs/api/admin/oauth

  2. when you load the NR editor, pass in that access token in the url as a query param - ?access_token=YOUR_TOKEN - that will bypass the login screen.

2 Likes

@knolleary Hey Nick, thank for your solution, it resolves my problem.

Much appreciated your reply. :slight_smile: Cheers!!!