zoernert / node-red-contrib-toyota-myt

Retrieve Data from Toyota MyT App
MIT License
2 stars 0 forks source link

RemoteControl trouble #3

Open ygageot opened 9 months ago

ygageot commented 9 months ago

I just tried with my car. the beginning works but not RemoteControl request. I join the console....

Error: Request failed with status code 400 at createError (/Users/ygageot/.node-red/node_modules/axios/lib/core/createError.js:16:15) at settle (/Users/ygageot/.node-red/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/Users/ygageot/.node-red/node_modules/axios/lib/adapters/http.js:312:11) at IncomingMessage.emit (node:events:526:35) at endReadableNT (node:internal/streams/readable:1376:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { 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, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, /', 'X-TME-LC': 'de-de', 'X-TME-LOCALE': 'de-de', 'X-TME-TOKEN': 'zojLRbtr6j6ZadzAKn1EIdcvXPQ.AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..', Cookie: 'iPlanetDirectoryPro=zojLRbtr6j6ZadzAKn1EIdcvXPQ.AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..', 'X-TME-APP-VERSION': '4.10.0', uuid: '8523b617-2c04-4ed9-af5d-0a9895993138', 'User-Agent': 'axios/0.25.0' }, method: 'get', url: 'https://myt-agg.toyota-europe.com/cma/api/vehicles/JTDACCCU703008557/remoteControl/status', data: undefined }, 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)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: true, _last: true, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'myt-agg.toyota-europe.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 9, connecting: false, _hadError: false, _parent: null, _host: 'myt-agg.toyota-europe.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, timeout: 5000, parser: null, _httpMessage: null,

  [Symbol(res)]: [TLSWrap],
  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: -1,
  [Symbol(kHandle)]: [TLSWrap],
  [Symbol(lastWriteQueueSize)]: 0,
  [Symbol(timeout)]: Timeout {
    _idleTimeout: 5000,
    _idlePrev: [TimersList],
    _idleNext: [Timeout],
    _idleStart: 677389915,
    _onTimeout: [Function: bound ],
    _timerArgs: undefined,
    _repeat: null,
    _destroyed: false,
    [Symbol(refed)]: false,
    [Symbol(kHasPrimitive)]: false,
    [Symbol(asyncId)]: 54089044,
    [Symbol(triggerId)]: 54089042
  },
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(kCapture)]: false,
  [Symbol(kSetNoDelay)]: false,
  [Symbol(kSetKeepAlive)]: true,
  [Symbol(kSetKeepAliveInitialDelay)]: 1,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(connect-options)]: [Object]
},
_header: 'GET /cma/api/vehicles/JTDACCCU703008557/remoteControl/status HTTP/1.1\r\n' +
  'Accept: application/json, text/plain, */*\r\n' +
  'X-TME-LC: de-de\r\n' +
  'X-TME-LOCALE: de-de\r\n' +
  'X-TME-TOKEN: zojLRbtr6j6ZadzAKn1EIdcvXPQ.*AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..*\r\n' +
  'Cookie: iPlanetDirectoryPro=zojLRbtr6j6ZadzAKn1EIdcvXPQ.*AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..*\r\n' +
  'X-TME-APP-VERSION: 4.10.0\r\n' +
  'uuid: 8523b617-2c04-4ed9-af5d-0a9895993138\r\n' +
  'User-Agent: axios/0.25.0\r\n' +
  'Host: myt-agg.toyota-europe.com\r\n' +
  'Connection: keep-alive\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: true,
  maxSockets: Infinity,
  maxFreeSockets: 256,
  scheduling: 'lifo',
  maxTotalSockets: Infinity,
  totalSocketCount: 2,
  maxCachedSessions: 100,
  _sessionCache: [Object],
  [Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/cma/api/vehicles/JTDACCCU703008557/remoteControl/status',
_ended: true,
res: IncomingMessage {
  _readableState: [ReadableState],
  _events: [Object: null prototype],
  _eventsCount: 4,
  _maxListeners: undefined,
  socket: null,
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  httpVersion: '1.1',
  complete: true,
  rawHeaders: [Array],
  rawTrailers: [],
  joinDuplicateHeaders: undefined,
  aborted: false,
  upgrade: false,
  url: '',
  method: null,
  statusCode: 400,
  statusMessage: 'Bad Request',
  client: [TLSSocket],
  _consuming: false,
  _dumped: false,
  req: [Circular *1],
  responseUrl: 'https://myt-agg.toyota-europe.com/cma/api/vehicles/JTDACCCU703008557/remoteControl/status',
  redirects: [],
  [Symbol(kCapture)]: false,
  [Symbol(kHeaders)]: [Object],
  [Symbol(kHeadersCount)]: 28,
  [Symbol(kTrailers)]: null,
  [Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: true,
host: 'myt-agg.toyota-europe.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: 0,
  _requestBodyBuffers: [],
  _onNativeResponse: [Function (anonymous)],
  _currentRequest: [Circular *1],
  _currentUrl: 'https://myt-agg.toyota-europe.com/cma/api/vehicles/JTDACCCU703008557/remoteControl/status',
  [Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
  accept: [Array],
  'x-tme-lc': [Array],
  'x-tme-locale': [Array],
  'x-tme-token': [Array],
  cookie: [Array],
  'x-tme-app-version': [Array],
  uuid: [Array],
  'user-agent': [Array],
  host: [Array]
},
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null

}, response: { status: 400, statusText: 'Bad Request', headers: { 'content-type': 'application/json;charset=utf-8', id: '9ba8fa4c-ac3e-405e-8f9c-ade41b333a2b', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', pragma: 'no-cache', expires: '0', 'x-frame-options': 'DENY', vary: 'Origin', 'access-control-allow-credentials': 'true', 'content-length': '181', date: 'Sun, 26 Nov 2023 12:23:34 GMT', connection: 'keep-alive', 'strict-transport-security': 'max-age=86400' }, config: { transitional: [Object], adapter: [Function: httpAdapter], transformRequest: [Array], transformResponse: [Array], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], headers: [Object], method: 'get', url: 'https://myt-agg.toyota-europe.com/cma/api/vehicles/JTDACCCU703008557/remoteControl/status', data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: true, _last: true, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: true, socket: [TLSSocket], _header: 'GET /cma/api/vehicles/JTDACCCU703008557/remoteControl/status HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'X-TME-LC: de-de\r\n' + 'X-TME-LOCALE: de-de\r\n' + 'X-TME-TOKEN: zojLRbtr6j6ZadzAKn1EIdcvXPQ.AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..\r\n' + 'Cookie: iPlanetDirectoryPro=zojLRbtr6j6ZadzAKn1EIdcvXPQ.AAJTSQACMDIAAlNLABxzYk8xcGY3TndEbHVsQVd2Y1VGWHMwTzRyNjg9AAR0eXBlAANDVFMAAlMxAAIwMQ..*\r\n' + 'X-TME-APP-VERSION: 4.10.0\r\n' + 'uuid: 8523b617-2c04-4ed9-af5d-0a9895993138\r\n' + 'User-Agent: axios/0.25.0\r\n' + 'Host: myt-agg.toyota-europe.com\r\n' + 'Connection: keep-alive\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, joinDuplicateHeaders: undefined, path: '/cma/api/vehicles/JTDACCCU703008557/remoteControl/status', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: true, host: 'myt-agg.toyota-europe.com', protocol: 'https:', _redirectable: [Writable],

  [Symbol(kBytesWritten)]: 0,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(errored)]: null,
  [Symbol(kHighWaterMark)]: 16384,
  [Symbol(kRejectNonStandardBodyWrites)]: false,
  [Symbol(kUniqueHeaders)]: null
},
data: {
  timestamp: 1701001414196,
  status: 400,
  error: 'Bad Request',
  message: "Required request header 'X-TME-BRAND' for method parameter type String is not present",
  errorCode: 'CMA400'
}

}, isAxiosError: true, toJSON: [Function: toJSON] }

ygageot commented 9 months ago

I founded a solution adding : 'X-TME-BRAND': 'TOYOTA', in the headers