UNPKG

node-red-contrib-mnubo

Version:

Mnubo

75 lines (69 loc) 3 kB
<script type="text/javascript"> RED.nodes.registerType('mnubo auth', { category: 'SmartObjects', color: '#00a1e0', defaults: { name: { value: '' }, mnuboconfig: { value: '', type: 'mnubo config', required: true }, }, inputs: 1, outputs: 1, icon: 'Authenticate.png', align: 'left', label: function() { return this.name || 'Authentication'; }, labelStyle: function() { return this.name ? 'node_label_italic' : ''; }, button: { onclick: function() { var label = this.name || 'button'; var node = this; $.ajax({ url: 'auth/' + this.id + '/button', type: 'POST', success: function(resp, textStatus, xhr) { RED.notify(node._('local injection', { label: label }), 'success'); }, error: function(resp, textStatus, xhr) { RED.notify(node._('local injection', { label: label }), 'error'); }, }); }, }, }); </script> <script type="text/x-red" data-template-name="mnubo auth"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"></input> </div> <div class="form-row"> <label for="node-input-mnuboconfig"><i class="fa fa-database"></i> mnubo config</label> <input type="text" id="node-input-mnuboconfig"></input> </div> </script> <script type="text/x-red" data-help-name="mnubo auth"> <p>This node will perform authentication on SmartObjects.</p> <p>The requested access token will be stored for future use.</p> <p>The access token expiry time will also be stored (for status display purpose).</p> <p>This node is optional. If it is not used, the other node(s) will request authentication automatically, but their status display will show the status Unauthorized (until they are used).</p> <h3>Inputs</h3> <ul> <li>you can press the button to request authentication.</li> <li>you can inject a null msg.payload to trigger the authentication.</li> </ul> <h3>Requirements</h3> <ol> <li> <b>Mnubo configuration:</b> A valid Environment and Credentials. </li> </ol> <p>To use SmartObjects nodes, you will need to have a valid mnubo account, with access granted on a namespace. To obtain your unique namespace in the SmartObjects platform, contact sales@mnubo.com . Please use the subject title <b>node-red-contrinb-mnubo</b> and include in the body of the email the name of your company, contact name and phone number.</p> <h3>References</h3> <ul> <li><a href="https://smartobjects.mnubo.com/documentation/api_security.html#" target="_blank">SmartObjects online documentation </a> - (under the API section) for details about this interface usage. </li> <li><a href="https://github.com/mnubo/node-red-contrib-mnubo" target="_blank">GitHub</a> - the nodes github repository</li> </ul> </script>