balansse / homebridge-vivint

Integrates Vivint security system with Apple Home
Other
46 stars 16 forks source link

MFA issue with new install #107

Open stevemerrill8 opened 1 year ago

stevemerrill8 commented 1 year ago

New install of homebridge unable to obtain MFA token.

Tried all the workarounds I could find. Receiving 403 error code 1020

In the past I had to run the MFA in an incognito browser. This time didn't work. Created a new user on vivint just for homebridge. No go. Attempted npm run mfa. It accepted the login, but never received the MFA code via email as I do when signing in directly to the vivint site.

Running: @balansse/homebridge-vivint v1.7.0 homebridge-config-ui-x v4.50.2 OS: Raspbian GNU/Linux Bullseye (11) Node.js Version v18.12.1

jgrimard commented 1 year ago

Can you post the rest of the error message? Just leave out the Cookie s=xxxxx part if there is one. Also, can you try opening the terminal in homebridge and running the following? Click the 3 dots on the right then click terminal. ping vivintsky.com It should return something similar to:

homebridge@homebridge:/var/lib/homebridge$ ping vivintsky.com
PING vivintsky.com(2606:4700:4400::6812:22df (2606:4700:4400::6812:22df)) 56 data bytes
64 bytes from 2606:4700:4400::6812:22df (2606:4700:4400::6812:22df): icmp_seq=1 ttl=57 time=4.92 ms
64 bytes from 2606:4700:4400::6812:22df (2606:4700:4400::6812:22df): icmp_seq=2 ttl=57 time=5.23 ms
64 bytes from 2606:4700:4400::6812:22df (2606:4700:4400::6812:22df): icmp_seq=3 ttl=57 time=5.02 ms
64 bytes from 2606:4700:4400::6812:22df (2606:4700:4400::6812:22df): icmp_seq=4 ttl=57 time=5.35 ms
64 bytes from 2606:4700:4400::6812:22df (2606:4700:4400::6812:22df): icmp_seq=5 ttl=57 time=5.09 ms
stevemerrill8 commented 1 year ago

Here's the code from attempting to run the mfa manually. I removed my user/pass info. Hope it helps.

StatusCodeError: 403 - "error code: 1020" at new StatusCodeError (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/errors.js:32:15) at plumbing.callback (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request-promise-core/lib/plumbing.js:46:31) at self.callback (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:185:22) at Request.emit (node:events:513:28) at Request. (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:1154:10) at Request.emit (node:events:513:28) at IncomingMessage. (/var/lib/homebridge/node_modules/@balansse/homebridge-vivint/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:627:28) at IncomingMessage.emit (node:events:525:35) { statusCode: 403, error: 'error code: 1020', options: { method: 'POST', url: 'https://www.vivintsky.com/api/login', body: { username: 'REMOVED', password:REMOVED persist_session: true }, json: true, resolveWithFullResponse: true, callback: [Function: RP$callback], transform: undefined, simple: true, transform2xxOnly: false }, response: <ref *1> IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: true, ended: true, endEmitted: true, reading: false, constructed: true, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, errorEmitted: false, emitClose: true, autoDestroy: true, destroyed: true, errored: null, closed: true, closeEmitted: true, defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain: false, readingMore: true, dataEmitted: true, decoder: null, encoding: null,

},
_events: [Object: null prototype] {
  end: [Array],
  close: [Array],
  data: [Function (anonymous)],
  error: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: TLSSocket {
  _tlsOptions: [Object],
  _secureEstablished: true,
  _securePending: false,
  _newSessionPending: false,
  _controlReleased: true,
  secureConnecting: false,
  _SNICallback: null,
  servername: 'www.vivintsky.com',
  alpnProtocol: false,
  authorized: true,
  authorizationError: null,
  encrypted: true,
  _events: [Object: null prototype],
  _eventsCount: 10,
  connecting: false,
  _hadError: false,
  _parent: null,
  _host: 'www.vivintsky.com',
  _closeAfterHandlingError: false,
  _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: [ClientRequest],
  [Symbol(res)]: [TLSWrap],
  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: 67,
  [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)]: false,
  [Symbol(kSetKeepAliveInitialDelay)]: 0,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(connect-options)]: [Object]
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [
  'Date',
  'Sun, 16 Apr 2023 17:12:24 GMT',
  'Content-Type',
  'text/plain; charset=UTF-8',
  'Content-Length',
  '16',
  'Connection',
  'close',
  'X-Frame-Options',
  'SAMEORIGIN',
  'Referrer-Policy',
  'same-origin',
  'Cache-Control',
  'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
  'Expires',
  'Thu, 01 Jan 1970 00:00:01 GMT',
  'Set-Cookie',
  '__cf_bm=8i57ZGqA8Pxh46MV4tWKcVMi1cVRsdmlXzPZCb4LxJA-1681665144-0-AVyuKwRcLMgdlB4qyPwvsfxqTDbozphlxoP+3j7s3pqQf9eawouXCIPviBAsG3SPypzbk46z+U4teKdE7zibdKI=; path=/; expires=Sun, 16-Apr-23 17:42:24 GMT; domain=.vivintsky.com; HttpOnly; Secure',
  'Server',
  'cloudflare',
  'CF-RAY',
  '7b8e0d8f0c930855-SLC'
],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 403,
statusMessage: 'Forbidden',
client: TLSSocket {
  _tlsOptions: [Object],
  _secureEstablished: true,
  _securePending: false,
  _newSessionPending: false,
  _controlReleased: true,
  secureConnecting: false,
  _SNICallback: null,
  servername: 'www.vivintsky.com',
  alpnProtocol: false,
  authorized: true,
  authorizationError: null,
  encrypted: true,
  _events: [Object: null prototype],
  _eventsCount: 10,
  connecting: false,
  _hadError: false,
  _parent: null,
  _host: 'www.vivintsky.com',
  _closeAfterHandlingError: false,
  _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: [ClientRequest],
  [Symbol(res)]: [TLSWrap],
  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: 67,
  [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)]: false,
  [Symbol(kSetKeepAliveInitialDelay)]: 0,
  [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,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: 87,
  _hasBody: true,
  _trailer: '',
  finished: true,
  _headerSent: true,
  _closed: false,
  socket: [TLSSocket],
  _header: 'POST /api/login HTTP/1.1\r\n' +
    'host: www.vivintsky.com\r\n' +
    'accept: application/json\r\n' +
    'content-type: application/json\r\n' +
    'content-length: 87\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/api/login',
  _ended: true,
  res: [Circular *1],
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'www.vivintsky.com',
  protocol: 'https:',
  [Symbol(kCapture)]: false,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(kEndCalled)]: true,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(kUniqueHeaders)]: null
},
request: Request {
  _events: [Object: null prototype],
  _eventsCount: 5,
  _maxListeners: undefined,
  method: 'POST',
  body: '{"username":"REMOVED","password":"REMOVED","persist_session":true}',
  resolveWithFullResponse: true,
  readable: true,
  writable: true,
  explicitMethod: true,
  _qs: [Querystring],
  _auth: [Auth],
  _oauth: [OAuth],
  _multipart: [Multipart],
  _redirect: [Redirect],
  _tunnel: [Tunnel],
  _rp_resolve: [Function (anonymous)],
  _rp_reject: [Function (anonymous)],
  _rp_promise: [Promise],
  _rp_callbackOrig: undefined,
  callback: [Function (anonymous)],
  _rp_options: [Object],
  headers: [Object],
  setHeader: [Function (anonymous)],
  hasHeader: [Function (anonymous)],
  getHeader: [Function (anonymous)],
  removeHeader: [Function (anonymous)],
  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: 'www.vivintsky.com',
  path: '/api/login',
  _json: true,
  httpModule: [Object],
  agentClass: [Function: Agent],
  agent: [Agent],
  _started: true,
  href: 'https://www.vivintsky.com/api/login',
  req: [ClientRequest],
  ntick: true,
  response: [Circular *1],
  originalHost: 'www.vivintsky.com',
  originalHostHeaderName: 'host',
  responseContent: [Circular *1],
  _destdata: true,
  _ended: true,
  _callbackCalled: true,
  [Symbol(kCapture)]: false
},
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: 'error code: 1020',
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: {
  date: 'Sun, 16 Apr 2023 17:12:24 GMT',
  'content-type': 'text/plain; charset=UTF-8',
  'content-length': '16',
  connection: 'close',
  'x-frame-options': 'SAMEORIGIN',
  'referrer-policy': 'same-origin',
  'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
  expires: 'Thu, 01 Jan 1970 00:00:01 GMT',
  'set-cookie': [Array],
  server: 'cloudflare',
  'cf-ray': '7b8e0d8f0c930855-SLC'
},
[Symbol(kHeadersCount)]: 22,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0

}

stevemerrill8 commented 1 year ago

ping:

PING vivintsky.com (104.18.34.223) 56(84) bytes of data. 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=1 ttl=57 time=18.1 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=2 ttl=57 time=18.0 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=3 ttl=57 time=37.9 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=4 ttl=57 time=15.7 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=5 ttl=57 time=47.3 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=6 ttl=57 time=13.3 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=7 ttl=57 time=13.2 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=8 ttl=57 time=11.9 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=9 ttl=57 time=424 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=10 ttl=57 time=22.1 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=11 ttl=57 time=16.7 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=12 ttl=57 time=34.7 ms 64 bytes from 104.18.34.223 (104.18.34.223): icmp_seq=13 ttl=57 time=15.4 ms

jgrimard commented 1 year ago

The error code 1020 means that Cloudflare is blocking your IP address from accessing the API. The plugin must have attempted to log in too many times in a short amount of time and it triggered it. There isn't much you can do other than to wait. I think Cloudflare will reset itself after 24 hours as long as you don't keep trying to log in. Make sure you disable the plugin or it will keep trying to re-connect every 30 seconds or 5 minutes or something. https://www.howtogeek.com/853271/how-to-fix-error-1020-access-denied/

stevemerrill8 commented 1 year ago

I've attempted to address this as well. Disabled the plugin, waited 24 hours, and enabled & immediately attempted to run the MFA process. Still didn't work. Same error.

It appears there's something else causing it to fail.