The `node-red-contrib-oauth2` package provides a specialized Node-RED node designed to streamline OAuth2 authentication flows within Node-RED environments. Its primary function is to facilitate the acquisition of access tokens from an OAuth2 server, which can then be seamlessly integrated into subsequent Node-RED nodes for making authenticated API requests. The current stable version is 6.2.1, with recent updates in May 2024, indicating an active development lifecycle and consistent release cadence. Notable features in recent versions include enhanced support for the OAuth2 implicit flow and a configurable option to force token refreshes. This node differentiates itself by abstracting complex OAuth2 mechanics into a visually configurable component within the Node-RED visual programming paradigm, supporting both static and dynamic credential management across various OAuth2 grant types, including Authorization Code, Client Credentials, Password, and Implicit flows.
npm install node-red-contrib-oauth2Verified import paths — ran on the pinned version, not inferred.
This Node-RED flow demonstrates various OAuth2 grant types (Authorization Code, Client Credentials, Password) and how to manage token refresh. It provides a visual representation of obtaining and utilizing access tokens within a Node-RED environment for authenticated API requests.
After upgrading to v6.0.0 or later, review and reconfigure existing OAuth2 nodes, paying close attention to the new `access_type`, `response_type`, and `prompt` options if applicable. Thoroughly test all affected Node-RED flows.
Upgrade `node-red-contrib-oauth2` to version 4.1.5 or newer, which includes a fix addressing this certificate validation issue. If the problem persists, ensure your Node.js environment's trust store includes the Certificate Authority for the OAuth2 server, or (with caution) temporarily disable TLS certificate validation for testing.
Carefully verify all OAuth2 configuration parameters (Client ID, Client Secret, Authorization URL, Token URL, Redirect URI, Scopes) against the official documentation of your OAuth2 provider. Ensure the Redirect URI configured in Node-RED is exactly registered with your provider.
Upgrade `node-red-contrib-oauth2` to v4.1.5 or newer. If the issue persists, ensure your Node.js environment trusts the certificate authority that signed the OAuth2 server's certificate or explicitly add it. In development, setting `NODE_TLS_REJECT_UNAUTHORIZED=0` can bypass this, but is not recommended for production.
Confirm the package is installed by running `npm install node-red-contrib-oauth2` in your Node-RED user directory (`~/.node-red`) or by using the Node-RED Palette Manager. After installation, restart your Node-RED instance to refresh the editor's palette.
Verify that the Client ID and Client Secret configured in the OAuth2 node are correct and match those registered with your OAuth2 provider. Also, ensure the chosen Grant Type (e.g., Client Credentials, Authorization Code, Password) is supported and correctly configured on both the Node-RED node and the OAuth2 server.
Update the redirect URI in the OAuth2 node's configuration to exactly match one of the URIs registered and allowed by your OAuth2 provider. Pay close attention to the protocol (HTTP/HTTPS), hostname, port, and path, as these must be identical.