title: Device connected, but 'IBMIoT: Error: Connection refused: Not authorized' message keeps popping up
body: <p>I am experimenting with IoT services in IBM Bluemix, attending <a href="https://www.coursera.org/learn/developer-iot" rel="nofollow noreferrer">a running MOOC at Coursera</a>. I have set up my trial account and successfully registered some devices. I am testing the connectivity between Bluemix and my Raspberry Pi with the following simple Node-RED flow in Bluemix:</p>
  
  <p><a href="https://i.stack.imgur.com/9j6UG.png" rel="nofollow noreferrer">Node-RED flow @ Bluemix<img src="https://i.stack.imgur.com/9j6UG.png" alt="enter image description here"></a></p>
  
  <p>where <code>normal</code> and <code>alert</code> are simple injection nodes of the respective strings, the <code>format message</code> node is similarly simple (returns <code>msg</code>, where <code>msg.payload = {'a' : {'indicator' : msg.payload}};</code>, and the <code>IBM IoT</code> node is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/eJQz7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJQz7.png" alt="enter image description here"></a></p>
  
  <p>The senseHAT device is registered and successfully connected to Bluemix, as apparent from the Watson IoT Platform dashboard:</p>
  
  <p><a href="https://i.stack.imgur.com/ofDEw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ofDEw.png" alt="enter image description here"></a></p>
  
  <p>From the Raspberry side, I have set the following simple flow to catch the 'commands' (<code>normal</code> and <code>alert</code>) issued in Bluemix:</p>
  
  <p><a href="https://i.stack.imgur.com/FHAEG.png" rel="nofollow noreferrer">Node-RED flow @ Raspberry Pi<img src="https://i.stack.imgur.com/FHAEG.png" alt="enter image description here"></a></p>
  
  <p>with the <code>all commands</code> node being as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/npLkD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/npLkD.png" alt="enter image description here"></a></p>
  
  <p>Now, although the 'commands' <code>normal</code> and <code>alert</code> pass through from Bluemix to my Raspberry, I keep on getting the subject error message, as shown below (notice the time stamps):</p>
  
  <p><a href="https://i.stack.imgur.com/kZCMt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZCMt.png" alt="enter image description here"></a></p>
  
  <p>and a similar error message is logged in the Node-RED console (once per minute):</p>
  
  <pre><code>Connection Error :: Error: Connection refused: Not authorized
  9 Jun 19:41:19 - [error] IBMIoT: Error: Connection refused: Not authorized
  Iotfclient is offline. Retrying connection
  Connection was closed.
  </code></pre>
  
  <p>I wonder how it is possible, on the one hand to have the 'commands' passed through, while on the other hand to get at error message per minute claiming that I am not connected since my device is not authorized.</p>
  
  <p>Any ideas?</p>
  
  <p>On a side note (and as possibly useful additional info):</p>
  
  <ol>
  <li>pressing 'Refresh' in the Watson IoT Platform dashboard, the senseHAT device appears disconnected; refreshing the whole page (ie from the browser), it appears again connected</li>
  <li>no matter what I have tried, I cannot connect the other two devices shown above (<code>b827eb0a0ee8</code> and <code>b827eb5f5bbd</code>) - I even tried deleting and re-registering them again in Bluemix...</li>
  </ol>