Http request Method put "Unauthorized"

"I'm using the HTTP request to write flows in Node-RED from a repository, it was working perfectly until I enabled adminAuth. After enabling it, I receive the following message 'Unauthorized.' I've tried using basic, digest, and bearer authentication with the username and password I use for logging into Node-RED, but it doesn't work. The issue is not with fetching from the repository as I can retrieve the JSON exactly; the problem is specifically with the PUT request. Does anyone have any ideas on how to resolve this? I need to have adminAuth."

Hi @fabio.amorim

The Admin API uses token based authentication, therefore you need to have a token before hand.

You obtain an access_token with a call to the auth API.

See below
POST /auth/token : Node-RED (nodered.org)

Once you have a token, you can then use that with the request node set to bearer authentication

1 Like

Hi @marcus-j-davies

I was able to obtain the token, and I would like to know if it's possible to modify its expiration time.

Add this to adminAuth

adminAuth: {
    sessionExpiryTime: XXXXXX, /* Seconds */
    ...
}
1 Like

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