dubocr / homebridge-tahoma

Homebridge plugin for TaHoma, Connexoon, Cozytouch, Energeasy Connect.
Apache License 2.0
137 stars 42 forks source link

Error 401 Bad credentials (AUTHENTICATION_ERROR) #387

Closed barthoefs closed 1 year ago

barthoefs commented 2 years ago

Same issue here since updating today.

[9/7/2022, 5:46:28 PM] [Connexoon] API client will be locked for 60 seconds because of bad credentials or temporary service outage. You can restart plugin to force login retry (not recommanded except if you think your credentials are wrong).
[9/7/2022, 5:46:28 PM] [Connexoon] Error 401 Bad credentials (AUTHENTICATION_ERROR)
[9/7/2022, 5:46:28 PM] TypeError: this.log is not a function
    at process.error (/homebridge/node_modules/homebridge/src/logger.ts:139:10)
    at process.emit (node:events:513:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
    at emit (node:internal/process/promises:140:20)
    at processPromiseRejections (node:internal/process/promises:274:27)
    at processTicksAndRejections (node:internal/process/task_queues:97:32)
/homebridge/node_modules/homebridge/lib/logger.js:90
        this.log("error" /* ERROR */, message, ...parameters);
             ^

TypeError: this.log is not a function
    at process.error (/homebridge/node_modules/homebridge/src/logger.ts:139:10)
    at process.emit (node:events:525:35)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
    at process._fatalException (node:internal/process/execution:167:25)

homebridge-tahoma v2.2.31

//EDIT - Same with latest update v2.2.32

My password is working in your site: image

and on the somfy website and app

Devices SETUP-0803-2123-6951

stefanschleich commented 2 years ago

Same here.

barthoefs commented 2 years ago

Did auto resolve yesterday evening. Started failing again this morning...

trolli-ch commented 2 years ago

+1 (changed to API which seems to work for authentication, but then lang file issue)...

adavison007 commented 2 years ago

+1 (changed to API which seems to work for authentication, but then lang file issue)...

@trolli-ch I've created the Api and done developer made, I've added the generated details to username and password, but Which field do I put the API token? thanks in advance

dubocr commented 2 years ago

Could you please add config param "debug": true then repost logs when error occurs. I published un update to fix homebridge restart when exception occurs.

If error is AUTHENTICATION_ERROR, comment here. If error is RESOURCE_ACCESS_DENIED, comment on #386

Thank you

trolli-ch commented 2 years ago

After updating to the newest version and changing back to username & password all is good again. The devices were moved to the standard room, don't know why....

dubocr commented 2 years ago

Switching between local API and cloud service break the HomeKit configuration, that's why all your devices moved to standard room.

davidXire commented 2 years ago

Personnellement j'ai une erreur AUTHENTICATION_ERROR. Les credentials fonctionnement très bien sur le site somfy ou ton site.

[09/09/2022, 11:21:23] [TaHoma] API client will be locked for 4 minutes because of bad credentials or temporary service outage. You can restart plugin to force login retry (not recommanded except if you think your credentials are wrong).
[09/09/2022, 11:21:23] [TaHoma] Error 401 Bad credentials (AUTHENTICATION_ERROR)
[09/09/2022, 11:21:23] [TaHoma] Retry in 120 sec...
[09/09/2022, 11:21:23] [TaHoma] [AxiosError: Request failed with status code 401] {
  code: 'ERR_BAD_REQUEST',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function: httpAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function] },
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
      'User-Agent': 'axios/0.27.2',
      'Content-Length': 68
    },
    baseURL: 'https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI',
    method: 'post',
    url: '/login',
    data: 'userId=****'
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: false,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: null,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: false,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'ha101-1.overkiz.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'ha101-1.overkiz.com',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [Circular *1],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 2327,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: true,
      [Symbol(kSetKeepAliveInitialDelay)]: 60,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object],
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'POST /enduser-mobile-web/enduserAPI/login HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'Content-Type: application/x-www-form-urlencoded;charset=utf-8\r\n' +
      'User-Agent: axios/0.27.2\r\n' +
      'Content-Length: 68\r\n' +
      'Host: ha101-1.overkiz.com\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype],
      freeSockets: [Object: null prototype] {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'POST',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/enduser-mobile-web/enduserAPI/login',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      rawHeaders: [Array],
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 401,
      statusMessage: '',
      client: [TLSSocket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/login',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 26,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'ha101-1.overkiz.com',
    protocol: 'https:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 68,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/login',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'content-type': [Array],
      'user-agent': [Array],
      'content-length': [Array],
      host: [Array]
    }
  },
  response: {
    status: 401,
    statusText: '',
    headers: {
      date: 'Fri, 09 Sep 2022 09:21:22 GMT',
      server: 'overkiz',
      'strict-transport-security': 'max-age=31536000; includeSubDomains, max-age=31536000 ; includeSubDomains',
      'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
      pragma: 'no-cache',
      expires: '0',
      'x-xss-protection': '1; mode=block',
      'x-frame-options': 'DENY',
      'x-content-type-options': 'nosniff',
      'content-type': 'application/json;charset=UTF-8',
      connection: 'close',
      'transfer-encoding': 'chunked'
    },
    config: {
      transitional: [Object],
      adapter: [Function: httpAdapter],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object],
      baseURL: 'https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI',
      method: 'post',
      url: '/login',
      data: 'userId=************************'
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: false,
      socket: [TLSSocket],
      _header: 'POST /enduser-mobile-web/enduserAPI/login HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/x-www-form-urlencoded;charset=utf-8\r\n' +
        'User-Agent: axios/0.27.2\r\n' +
        'Content-Length: 68\r\n' +
        'Host: ha101-1.overkiz.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/enduser-mobile-web/enduserAPI/login',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'ha101-1.overkiz.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    data: { errorCode: 'AUTHENTICATION_ERROR', error: 'Bad credentials' }
  }
}
dubocr commented 2 years ago

Bonjour,

Ce qui m'intéresserait ce sont les logs avant le blocage. Il y a du y avoir des requêtes trop fréquentes. Dans tous les cas, patienter (ou stopper temporairement le plugin) devrait suffire à rétablir le service.

Tontonpat commented 2 years ago

Bonjour Romain, je viens d’avoir cette erreur à nouveau en mode « cloud » (pas local). Mais j’avais enlevé le debug a cause des logs. Je le remets et je t’envoie ça si cela recommence

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Please make sure to update to the latest Homebridge TaHoma version to see if that solves the issue. This issue will be closed in case of inactivity.