Adding Bearer token as a HTTP Header


I try to create HTTP flows in which users try to authenticate and after positive verification, she or he get a response with a header that contains the token. So far, based on Authenticating Node-RED using JSONWebToken - Part 2 - Compose Articles and Header-based Authorization (flow) - Node-RED I have created such two flows:

The first one is a simple GET with an authentication form as a template and response. The second one POST with an authentication form, a function that retrieves a user from the database. Now I do not know:

  • how to verify if user exists
  • after positive verification how to create the token and add it to a response header.

The http-out node can be sent msg.headers containing json like that below:

    "Authorization": "Bearer 12345678"

where "12345678" is your token.

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