sibartlett/homebridge-wink3

Could not authenticate with local hub... StatusCodeError: 400

LordZork opened this issue · 0 comments

Hi @sibartlett

I don't think this was the case initially with your most recent update, but lately the plugin has been having issues.

Sometimes the plugin seems to work fine (despite the errors below), but sometimes it doesn't (and sometimes I am wondering if it might be causing other plugins to sometimes not respond).

Starting with "[Wink] Could not authenticate with local hub..." the log turns yellow and has errors... a lot of yellow errors...

[Wink] Hidden by hide_groups config option: Thermostat (thermostat/147231)
[Wink] Hidden by hide_groups config option: Bedroom sensor (sensor_pod/240356)
[Wink] Hidden by hide_groups config option: Garage Door (garage_door/130062)
[Wink] Not supported by HomeKit: Pivot Power Genius (powerstrip/51043)
[Wink] Not supported by HomeKit: Gang (gang/176162)
[Wink] Hidden by hide_groups config option: Wink Relay Sensor (sensor_pod/657995)
[Wink] Not supported by HomeKit: Wink Relay's Bottom Button (button/303314)
[Wink] Not supported by HomeKit: Wink Relay's Top Button (button/303315)
[Wink] Devices refreshed
[Wink] Checking if hub is reachable (Wink Relay, XXX.XXX.X.XXX)...
[Wink] Hub is reachable locally (Wink Relay, XXX.XXX.X.XXX)
[Wink] Could not authenticate with local hub (Wink Relay, XXX.XXX.X.XXX) StatusCodeError: 400 - {"data":{"error":"invalid_scope","error_description":"AAU_ID does not match"},"errors":["invalid_scope: AAU_ID does not match"],"pagination":{},"error":"invalid_scope","error_description":"AAU_ID does not match"}
    at new StatusCodeError (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  statusCode: 400,
  error: {
    data: {
      error: 'invalid_scope',
      error_description: 'AAU_ID does not match'
    },
    errors: [ 'invalid_scope: AAU_ID does not match' ],
    pagination: {},
    error: 'invalid_scope',
    error_description: 'AAU_ID does not match'
  },
  options: {
    baseUrl: 'https://api.wink.com',
    strictSSL: true,
    json: true,
    method: 'POST',
    uri: '/oauth2/token',
    body: {
      local_control_id: null,
      scope: 'local_control',
      grant_type: 'refresh_token',
      refresh_token: 'XXXX',
      client_id: 'XXXX',
      client_secret: 'XXXX'
    },
    headers: {
      'User-Agent': 'Manufacturer/Apple-iPhone10_1 iOS/11.2.6 WinkiOS/6.7.0.19-production-release (Scale/2.00)'
    },
    callback: [Function: RP$callback],
    transform: undefined,
    simple: true,
    resolveWithFullResponse: false,
    transform2xxOnly: false
  },
  response: IncomingMessage {
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: true,
      endEmitted: true,
      reading: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      emitClose: true,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: true,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
    readable: false,
    _events: [Object: null prototype] {
      end: [Array],
      close: [Array],
      data: [Function],
      error: [Function]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: true,
      _SNICallback: null,
      servername: 'api.wink.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.wink.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(asyncId)]: 8728,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    connection: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: true,
      _SNICallback: null,
      servername: 'api.wink.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.wink.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(asyncId)]: 8728,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    headers: {
      'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
      'content-type': 'application/json; charset=utf-8',
      expires: 'Fri, 01 Jan 1990 00:00:00 GMT',
      pragma: 'no-cache',
      'strict-transport-security': 'max-age=31536000',
      vary: 'Accept-Encoding',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'SAMEORIGIN',
      'x-request-id': 'XXXX',
      'x-runtime': '0.037083',
      'x-xss-protection': '1; mode=block',
      'content-length': '212',
      connection: 'Close'
    },
    rawHeaders: [
      'Cache-Control',
      'no-cache, no-store, max-age=0, must-revalidate',
      'Content-Type',
      'application/json; charset=utf-8',
      'Expires',
      'Fri, 01 Jan 1990 00:00:00 GMT',
      'Pragma',
      'no-cache',
      'Strict-Transport-Security',
      'max-age=31536000',
      'Vary',
      'Accept-Encoding',
      'X-Content-Type-Options',
      'nosniff',
      'X-Frame-Options',
      'SAMEORIGIN',
      'X-Request-Id',
      'XXXX',
      'X-Runtime',
      '0.037083',
      'X-XSS-Protection',
      '1; mode=block',
      'Content-Length',
      '212',
      'Connection',
      'Close'
    ],
    trailers: {},
    rawTrailers: [],
    aborted: false,
    upgrade: false,
    url: '',
    method: null,
    statusCode: 400,
    statusMessage: 'Bad Request',
    client: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: true,
      _SNICallback: null,
      servername: 'api.wink.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.wink.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(asyncId)]: 8728,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _consuming: false,
    _dumped: false,
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      connection: [TLSSocket],
      _header: 'POST /oauth2/token HTTP/1.1\r\n' +
        'User-Agent: Manufacturer/Apple-iPhone10_1 iOS/11.2.6 WinkiOS/6.7.0.19-production-release (Scale/2.00)\r\n' +
        'host: api.wink.com\r\n' +
        'accept: application/json\r\n' +
        'content-type: application/json\r\n' +
        'content-length: 227\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      insecureHTTPParser: undefined,
      path: '/oauth2/token',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    request: Request {
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      strictSSL: true,
      method: 'POST',
      uri: [Url],
      body: '{"local_control_id":null,"scope":"local_control","grant_type":"refresh_token","refresh_token":"XXXX","client_id":"XXXX","client_secret":"XXXX"}',
      headers: [Object],
      readable: true,
      writable: true,
      explicitMethod: true,
      _qs: [Querystring],
      _auth: [Auth],
      _oauth: [OAuth],
      _multipart: [Multipart],
      _redirect: [Redirect],
      _tunnel: [Tunnel],
      _rp_resolve: [Function],
      _rp_reject: [Function],
      _rp_promise: [Promise],
      _rp_callbackOrig: undefined,
      callback: [Function],
      _rp_options: [Object],
      setHeader: [Function],
      hasHeader: [Function],
      getHeader: [Function],
      removeHeader: [Function],
      localAddress: undefined,
      pool: [Object],
      dests: [],
      __isRequestRequest: true,
      _callback: [Function: RP$callback],
      proxy: null,
      tunnel: true,
      setHost: true,
      originalCookieHeader: undefined,
      _disableCookies: true,
      _jar: undefined,
      port: 443,
      host: 'api.wink.com',
      path: '/oauth2/token',
      _json: true,
      httpModule: [Object],
      agentClass: [Function: Agent],
      agent: [Agent],
      _started: true,
      href: 'https://api.wink.com/oauth2/token',
      req: [ClientRequest],
      ntick: true,
      response: [Circular],
      originalHost: 'api.wink.com',
      originalHostHeaderName: 'host',
      responseContent: [Circular],
      _destdata: true,
      _ended: true,
      _callbackCalled: true,
      [Symbol(kCapture)]: false
    },
    toJSON: [Function: responseToJSON],
    caseless: Caseless { dict: [Object] },
    body: {
      data: [Object],
      errors: [Array],
      pagination: {},
      error: 'invalid_scope',
      error_description: 'AAU_ID does not match'
    },
    [Symbol(kCapture)]: false
  }
}