node-red-contrib-oauth2
Version:
The node-red-contrib-oauth2 is a Node-RED node that provides an OAuth2 authentication flow. This node uses the OAuth2 protocol to obtain an access token, which can be used to make authenticated API requests.
1,501 lines (367 loc) • 15.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: OAuth2Node</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: OAuth2Node</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>OAuth2Node<span class="signature">(config)</span><span class="type-signature"></span></h2>
<div class="class-description">Class representing an OAuth2 Node.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="OAuth2Node"><span class="type-signature"></span>new OAuth2Node<span class="signature">(config)</span><span class="type-signature"></span></h4>
<div class="description">
Create an OAuth2Node.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Node configuration object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line13">line 13</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="cleanForm"><span class="type-signature"></span>cleanForm<span class="signature">(form)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Cleans form data by removing undefined or empty values.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>form</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The form data.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line229">line 229</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- The cleaned form data.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="configureProxy"><span class="type-signature"></span>configureProxy<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Configures proxy settings.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line209">line 209</a>
</li></ul></dd>
</dl>
<h4 class="name" id="generateOptions"><span class="type-signature"></span>generateOptions<span class="signature">(msg)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Generates options for the HTTP request.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Input message object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line94">line 94</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- The request options.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="handleError"><span class="type-signature"></span>handleError<span class="signature">(error, msg, send)</span><span class="type-signature"></span></h4>
<div class="description">
Handles errors from the POST request.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The error object.</td>
</tr>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Input message object.</td>
</tr>
<tr>
<td class="name"><code>send</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Function to send messages.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line294">line 294</a>
</li></ul></dd>
</dl>
<h4 class="name" id="handleResponse"><span class="type-signature"></span>handleResponse<span class="signature">(response, msg, send)</span><span class="type-signature"></span></h4>
<div class="description">
Handles the response from the POST request.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>response</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The response object.</td>
</tr>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Input message object.</td>
</tr>
<tr>
<td class="name"><code>send</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Function to send messages.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line272">line 272</a>
</li></ul></dd>
</dl>
<h4 class="name" id="makePostRequest"><span class="type-signature">(async) </span>makePostRequest<span class="signature">(options)</span><span class="type-signature"> → {Promise.<Object>}</span></h4>
<div class="description">
Makes a POST request.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The request options.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line240">line 240</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- The response from the request.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<Object></span>
</dd>
</dl>
<h4 class="name" id="onInput"><span class="type-signature">(async) </span>onInput<span class="signature">(msg, send, done)</span><span class="type-signature"></span></h4>
<div class="description">
Handles input messages.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Input message object.</td>
</tr>
<tr>
<td class="name"><code>send</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Function to send messages.</td>
</tr>
<tr>
<td class="name"><code>done</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Function to indicate processing is complete.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line60">line 60</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setStatus"><span class="type-signature"></span>setStatus<span class="signature">(color, text)</span><span class="type-signature"></span></h4>
<div class="description">
Sets the status of the node.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The color of the status indicator.</td>
</tr>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The status text.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="oauth2.js.html">oauth2.js</a>, <a href="oauth2.js.html#line318">line 318</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="OAuth2Node.html">OAuth2Node</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri May 24 2024 08:34:19 GMT-0300 (Brasilia Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>