yenoiwesa / homebridge-connexoon

A homebridge plugin to integrate Somfy blinds with the Connexoon RTS hub
Apache License 2.0
27 stars 2 forks source link

Authentication issues #3

Closed bowana closed 5 years ago

bowana commented 5 years ago

Hi, many thanks for pulling this plugin together.
It appears that I am still having authentication issues, although your version gives a little more insight. I'm getting the error. "Too many attemps with an invalid token, temporarily banned.'"

username and password are correct.

Any suggestions on how I might track this down?

Appreciate the help.

Tim

yenoiwesa commented 5 years ago

Hi @bowana,

That's interesting, I didn't know that too many attempts to use the Somfy OAuth service could result in being temporarily banned 😬

If I recall correctly from the other thread, you are based in Australia is that right? Are you able to successfully login to the Somfy website using the credentials you have setup in the homebridge configuration file at https://www.somfy.com.au/login

If you aren't, it means that your credentials are definitely invalid.

I would also be interested if you could copy/paste some of the error logs related to the homebridge-connexoon plugin in here (please redact any personal information). I'd like to check which step is failing.

bowana commented 5 years ago

Thanks for the reply. When I initially read it, I tried logging onto Somfy.com.au and indeed had an error (without explanation). Since then though, I can log on without issue. I am also access the Connexoon through the Somfy app without issues.

Below is a dump of the messages that appear on screen...does this help?

Cheers,

Tim

[10/6/2019, 8:37:44 PM] Loading 0 accessories... Load homebridge-doorbird.DoorBird [10/6/2019, 8:37:48 PM] [My Connexoon Hub] Failed to get device list { errorCode: 'RESOURCE_ACCESS_DENIED', error: 'Too many attemps with an invalid token, temporarily banned.' } [10/6/2019, 8:37:48 PM] [My Connexoon Hub] { StatusCodeError: 401 - {"errorCode":"RESOURCE_ACCESS_DENIED","error":"Too many attemps with an invalid token, temporarily banned."} at new StatusCodeError (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request/request.js:185:22) at Request.emit (events.js:189:13) at Request. (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request/request.js:1161:10) at Request.emit (events.js:189:13) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-connexoon/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:277:13) at IncomingMessage.emit (events.js:194:15) name: 'StatusCodeError', statusCode: 401, message: '401 - {"errorCode":"RESOURCE_ACCESS_DENIED","error":"Too many attemps with an invalid token, temporarily banned."}', error: { errorCode: 'RESOURCE_ACCESS_DENIED', error: 'Too many attemps with an invalid token, temporarily banned.' }, options: { auth: { bearer: 'MTM5ZTFmYTM3ZWFhYzAwODg1N2M1MTA3Njg4NDdhYTY3NTBlMzlhYThiYzJiYmZjMmIzNDcwMzg1YzRkMTE3MQ' }, url: 'https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/setup/devices', json: true, method: 'GET', 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: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, paused: false, emitClose: true, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, 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, _SNICallback: null, servername: 'ha201-1.overkiz.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 8, connecting: false, _hadError: false, _handle: [TLSWrap], _parent: null, _host: 'ha201-1.overkiz.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(asyncId)]: 124,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(connect-options)]: [Object] },
 connection:
  TLSSocket {
    _tlsOptions: [Object],
    _secureEstablished: true,
    _securePending: false,
    _newSessionPending: false,
    _controlReleased: true,
    _SNICallback: null,
    servername: 'ha201-1.overkiz.com',
    alpnProtocol: false,
    authorized: true,
    authorizationError: null,
    encrypted: true,
    _events: [Object],
    _eventsCount: 8,
    connecting: false,
    _hadError: false,
    _handle: [TLSWrap],
    _parent: null,
    _host: 'ha201-1.overkiz.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(asyncId)]: 124,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(connect-options)]: [Object] },
 httpVersionMajor: 1,
 httpVersionMinor: 1,
 httpVersion: '1.1',
 complete: true,
 headers:
  { date: 'Sun, 06 Oct 2019 09:37:48 GMT',
    server: 'overkiz',
    'strict-transport-security': 'max-age=31536000; includeSubDomains',
    'content-type': 'application/json;charset=ISO-8859-1',
    'content-length': '114',
    connection: 'close' },
 rawHeaders:
  [ 'Date',
    'Sun, 06 Oct 2019 09:37:48 GMT',
    'Server',
    'overkiz',
    'Strict-Transport-Security',
    'max-age=31536000; includeSubDomains',
    'Content-Type',
    'application/json;charset=ISO-8859-1',
    'Content-Length',
    '114',
    'Connection',
    'close' ],
 trailers: {},
 rawTrailers: [],
 aborted: false,
 upgrade: false,
 url: '',
 method: null,
 statusCode: 401,
 statusMessage: '',
 client:
  TLSSocket {
    _tlsOptions: [Object],
    _secureEstablished: true,
    _securePending: false,
    _newSessionPending: false,
    _controlReleased: true,
    _SNICallback: null,
    servername: 'ha201-1.overkiz.com',
    alpnProtocol: false,
    authorized: true,
    authorizationError: null,
    encrypted: true,
    _events: [Object],
    _eventsCount: 8,
    connecting: false,
    _hadError: false,
    _handle: [TLSWrap],
    _parent: null,
    _host: 'ha201-1.overkiz.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(asyncId)]: 124,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(connect-options)]: [Object] },
 _consuming: true,
 _dumped: false,
 req:
  ClientRequest {
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    output: [],
    outputEncodings: [],
    outputCallbacks: [],
    outputSize: 0,
    writable: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: [TLSSocket],
    connection: [TLSSocket],
    _header:
     'GET /enduser-mobile-web/enduserAPI/setup/devices HTTP/1.1\r\nhost: ha201-1.overkiz.com\r\nauthorization: Bearer MTM5ZTFmYTM3ZWFhYzAwODg1N2M1MTA3Njg4NDdhYTY3NTBlMzlhYThiYzJiYmZjMmIzNDcwMzg1YzRkMTE3MQ\r\naccept: application/json\r\nConnection: close\r\n\r\n',
    _onPendingData: [Function: noopPendingOutput],
    agent: [Agent],
    socketPath: undefined,
    timeout: undefined,
    method: 'GET',
    path: '/enduser-mobile-web/enduserAPI/setup/devices',
    _ended: true,
    res: [Circular],
    aborted: undefined,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    [Symbol(isCorked)]: false,
    [Symbol(outHeadersKey)]: [Object] },
 request:
  Request {
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    method: 'GET',
    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],
    headers: [Object],
    setHeader: [Function],
    hasHeader: [Function],
    getHeader: [Function],
    removeHeader: [Function],
    localAddress: undefined,
    pool: {},
    dests: [],
    __isRequestRequest: true,
    _callback: [Function: RP$callback],
    uri: [Url],
    proxy: null,
    tunnel: true,
    setHost: true,
    originalCookieHeader: undefined,
    _disableCookies: true,
    _jar: undefined,
    port: 443,
    host: 'ha201-1.overkiz.com',
    path: '/enduser-mobile-web/enduserAPI/setup/devices',
    _json: true,
    httpModule: [Object],
    agentClass: [Function],
    agent: [Agent],
    _started: true,
    href:
     'https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/setup/devices',
    req: [ClientRequest],
    ntick: true,
    response: [Circular],
    originalHost: 'ha201-1.overkiz.com',
    originalHostHeaderName: 'host',
    responseContent: [Circular],
    _destdata: true,
    _ended: true,
    _callbackCalled: true },
 toJSON: [Function: responseToJSON],
 caseless: Caseless { dict: [Object] },
 body:
  { errorCode: 'RESOURCE_ACCESS_DENIED',
    error:
     'Too many attemps with an invalid token, temporarily banned.' } } }
yenoiwesa commented 5 years ago

The logs indicate that the step fetching devices is failing, not the login step. Can you confirm that the bearer token is changing in the logs for each attempt?

I assume that you get this message after rebooting the entire Homebridge server, is that correct? If not, make sure to reboot the Homebridge server.

Which version of node are you using on your machine?

bowana commented 5 years ago

Thanks for the reply, looks like rebooting the server has corrected the issue (for now). I’m going to keep playing around with it but for now its all good. THANKS!

yenoiwesa commented 5 years ago

Do let me know if the problem reoccurs, as I'd like to make sure that this integration works well, including for my own usage :-)