sibartlett / homebridge-wink3

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

Stuck on oauth issue #52

Closed Jborn4christ closed 7 years ago

Jborn4christ commented 7 years ago

Two errors: This one prior to authorizing in safari (on a mac). Here's my config.json chunk for wink:

"platforms": [{ "platform": "Wink", "name": "Wink", "client_id": "client_id", "client_secret": "client_secret", "hide_groups": [ "thermostat" ], "fan_ids": [ "556496", "556577" ] },

[Wink] To authenticate, go here using a web browser: http://192.168.0.24:8888 [10/3/2017, 5:00:21 PM] Error: You did not specify {'token'} or {'clientId','clientSecret','code'}, one set of which is required for the new API at /usr/local/lib/node_modules/homebridge-nest/index.js:80:11 at setupConnection (/usr/local/lib/node_modules/homebridge-nest/index.js:64:9) at Object.accessories (/usr/local/lib/node_modules/homebridge-nest/index.js:143:3) at Server._loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:354:20) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:298:16) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:80:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 [10/3/2017, 5:00:21 PM] Falling back to legacy API.

This one once I authorize:

[10/3/2017, 5:02:52 PM] [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:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-wink3/node_modules/request/request.js:1091:12) at IncomingMessage.g (events.js:291:16) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) 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: 'ImKuzGCLFESq_EgG_BCGZntAgkm7fQi1', code: '2IO5_QzF3yqkOH-wDAxA' }, 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, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: [Object], close: [Object], 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, destroyed: true, _bytesDispatched: 251, _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 }, 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, destroyed: true, _bytesDispatched: 251, _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 }, 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', via: '1.1 spaces-router (fe33053d43ba)', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-request-id': 'dc261793-bdc4-829e-0fc0-a55f35cba23c', 'x-runtime': '0.049481', 'x-xss-protection': '1; mode=block', date: 'Tue, 03 Oct 2017 21:02:52 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', 'Via', '1.1 spaces-router (fe33053d43ba)', 'X-Content-Type-Options', 'nosniff', 'X-Frame-Options', 'SAMEORIGIN', 'X-Request-Id', 'dc261793-bdc4-829e-0fc0-a55f35cba23c', 'X-Runtime', '0.049481', 'X-Xss-Protection', '1; mode=block', 'Date', 'Tue, 03 Oct 2017 21:02:52 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, destroyed: true, _bytesDispatched: 251, _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 }, _consuming: true, _dumped: false, req: ClientRequest { domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, upgrading: false, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _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: 102\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, timeout: undefined, method: 'POST', path: '/oauth2/token', _ended: true, parser: null, res: [Circular] }, request: Request { domain: null, _events: [Object], _eventsCount: 5, _maxListeners: undefined, method: 'POST', uri: [Object], body: '{"grant_type":"code","client_secret":"ImKuzGCLFESq_EgG_BCGZntAgkm7fQi1","code":"2IO5_QzF3yqkOH-wDAxA"}', readable: true, writable: true, explicitMethod: true, _qs: [Object], _auth: [Object], _oauth: [Object], _multipart: [Object], _redirect: [Object], _tunnel: [Object], _rp_resolve: [Function: s], _rp_reject: [Function: t], _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: [Object], pagination: {}, error: 'invalid_grant', error_description: '' } } }

Jborn4christ commented 7 years ago

I got it. Figured out the issue(s).

sibartlett commented 7 years ago

What were the issues?

Jborn4christ commented 7 years ago

I had all kinds of stuff messed up. User error. I had edited my wink Oauth stuff so the secret changed, didn’t have config.json under the proper r/w ownership. My nest api was out of date. But managed to pick my way through each thing and get it all fixed. Just had to step away, clear the brain, and then get it fixed.

But I did find some references to snapshots for the momentum cameras. Going to see if I can get that working. Send snapshot on motion detection.