sibartlett / homebridge-wink3

Homebridge plugin for wink.com
https://sibartlett.github.io/homebridge-wink3
ISC License
53 stars 20 forks source link

Seems to do all right, but still get red alerts #95

Open winkhum opened 6 years ago

winkhum commented 6 years ago

Hi! I am new to this whole thing. I seem to follow the process and everything works till i get the message from homebridge to go to my local authetification with wink. I enter the adress and my account data and in browser it says that I am authentified, but when I swith to homebridge I get this -

[2018-4-17 11:04:22] [Wink] Could not authenticate with wink.com { StatusCodeError: 400 - {"data":{"error":"invalid_grant","error_description":""},"errors":["invalid_grant: "],"pagination":{},"error":"invalid_grant","error_description":""} 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:186:22) at emitTwo (events.js:125:13) at Request.emit (events.js:213:7) at Request. (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1163:10) at emitOne (events.js:115:13) at Request.emit (events.js:210:7) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1085:12) name: 'StatusCodeError', statusCode: 400, message: '400 - {"data":{"error":"invalid_grant","error_description":""},"errors":["invalid_grant: "],"pagination":{},"error":"invalid_grant","error_description":""}', error: { data: { error: 'invalid_grant', error_description: '' }, errors: [ 'invalid_grant: ' ], pagination: {}, error: 'invalid_grant', error_description: '' }, options: { method: 'POST', baseUrl: 'https://api.wink.com', uri: '/oauth2/token', body: { grant_type: 'code', client_secret: '4TNHa5T-nwxpvbJTMBBwytgbXfE-EU2', code: 'KvwAkX_YATmCLMWFOiOh' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [Object], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { 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: null, npnProtocol: false, alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object], _eventsCount: 9, connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'api.wink.com', _readableState: [Object], readable: false, domain: null, _maxListeners: undefined, _writableState: [Object], writable: false, allowHalfOpen: false, _bytesDispatched: 250, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: null, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Object], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1,

    [Symbol(bytesRead)]: 697 },
 connection: 
  TLSSocket {
    _tlsOptions: [Object],
    _secureEstablished: true,
    _securePending: false,
    _newSessionPending: false,
    _controlReleased: true,
    _SNICallback: null,
    servername: null,
    npnProtocol: false,
    alpnProtocol: false,
    authorized: true,
    authorizationError: null,
    encrypted: true,
    _events: [Object],
    _eventsCount: 9,
    connecting: false,
    _hadError: false,
    _handle: null,
    _parent: null,
    _host: 'api.wink.com',
    _readableState: [Object],
    readable: false,
    domain: null,
    _maxListeners: undefined,
    _writableState: [Object],
    writable: false,
    allowHalfOpen: false,
    _bytesDispatched: 250,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: undefined,
    _server: null,
    ssl: null,
    _requestCert: true,
    _rejectUnauthorized: true,
    parser: null,
    _httpMessage: [Object],
    read: [Function],
    _consuming: true,
    _idleNext: null,
    _idlePrev: null,
    _idleTimeout: -1,
    [Symbol(asyncId)]: 83,
    [Symbol(bytesRead)]: 697 },
 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',
    via: '1.1 spaces-router (159423a96b5e)',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'SAMEORIGIN',
    'x-request-id': 'b7c88514-abb1-7abe-8556-d6c42ef31be2',
    'x-runtime': '0.024305',
    'x-xss-protection': '1; mode=block',
    date: 'Tue, 17 Apr 2018 11:04:25 GMT',
    'content-length': '149',
    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',
    'Via',
    '1.1 spaces-router (159423a96b5e)',
    'X-Content-Type-Options',
    'nosniff',
    'X-Frame-Options',
    'SAMEORIGIN',
    'X-Request-Id',
    'b7c88514-abb1-7abe-8556-d6c42ef31be2',
    'X-Runtime',
    '0.024305',
    'X-Xss-Protection',
    '1; mode=block',
    'Date',
    'Tue, 17 Apr 2018 11:04:25 GMT',
    'Content-Length',
    '149',
    'Connection',
    'close' ],
 trailers: {},
 rawTrailers: [],
 upgrade: false,
 url: '',
 method: null,
 statusCode: 400,
 statusMessage: 'Bad Request',
 client: 
  TLSSocket {
    _tlsOptions: [Object],
    _secureEstablished: true,
    _securePending: false,
    _newSessionPending: false,
    _controlReleased: true,
    _SNICallback: null,
    servername: null,
    npnProtocol: false,
    alpnProtocol: false,
    authorized: true,
    authorizationError: null,
    encrypted: true,
    _events: [Object],
    _eventsCount: 9,
    connecting: false,
    _hadError: false,
    _handle: null,
    _parent: null,
    _host: 'api.wink.com',
    _readableState: [Object],
    readable: false,
    domain: null,
    _maxListeners: undefined,
    _writableState: [Object],
    writable: false,
    allowHalfOpen: false,
    _bytesDispatched: 250,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: undefined,
    _server: null,
    ssl: null,
    _requestCert: true,
    _rejectUnauthorized: true,
    parser: null,
    _httpMessage: [Object],
    read: [Function],
    _consuming: true,
    _idleNext: null,
    _idlePrev: null,
    _idleTimeout: -1,
    [Symbol(asyncId)]: 83,
    [Symbol(bytesRead)]: 697 },
 _consuming: true,
 _dumped: false,
 req: 
  ClientRequest {
    domain: null,
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    output: [],
    outputEncodings: [],
    outputCallbacks: [],
    outputSize: 0,
    writable: false,
    _last: true,
    upgrading: false,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: null,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: [Object],
    connection: [Object],
    _header: 'POST /oauth2/token HTTP/1.1\r\nhost: api.wink.com\r\naccept: application/json\r\ncontent-type: application/json\r\ncontent-length: 101\r\nConnection: close\r\n\r\n',
    _onPendingData: [Function: noopPendingOutput],
    agent: [Object],
    socketPath: undefined,
    timeout: undefined,
    method: 'POST',
    path: '/oauth2/token',
    _ended: true,
    res: [Circular],
    aborted: undefined,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    [Symbol(outHeadersKey)]: [Object] },
 request: 
  Request {
    domain: null,
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    method: 'POST',
    uri: [Object],
    body: '{"grant_type":"code","client_secret":"4TNHa5T-nwxpvbJTMBBwytgbXfE-EU2","code":"KvwAkX_YATmCLMWFOiOh"}',
    readable: true,
    writable: true,
    explicitMethod: true,
    _qs: [Object],
    _auth: [Object],
    _oauth: [Object],
    _multipart: [Object],
    _redirect: [Object],
    _tunnel: [Object],
    _rp_resolve: [Function],
    _rp_reject: [Function],
    _rp_promise: [Object],
    _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],
    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: [Object],
    agent: [Object],
    _started: true,
    href: 'https://api.wink.com/oauth2/token',
    req: [Object],
    ntick: true,
    response: [Circular],
    originalHost: 'api.wink.com',
    originalHostHeaderName: 'host',
    responseContent: [Circular],
    _destdata: true,
    _ended: true,
    _callbackCalled: true },
 toJSON: [Function: responseToJSON],
 caseless: Caseless { dict: [Object] },
 read: [Function],
 body: 
  { data: [Object],
    errors: [Array],
    pagination: {},
    error: 'invalid_grant',
    error_description: '' } } }
chathura86 commented 6 years ago

Having the same issue with my raspberry pi setup.

RachelF2Sea commented 5 years ago

Did you ever resolve this? I'm having the same probem

RachelF2Sea commented 5 years ago

Spoke too soon. I seem to have fixed mine. I must have made an error on the Client ID and when I copied, pasted and restarted homebridge, it all worked. Now to figure out how to use it...