ERROR: Bad request - please check your parameters

Describe the problem/error/question

I am using GitHub - HuakunShen/wol-web: A web app hosted locally for wakeonlan with to generate a request to the api, to turn on a device.
API: wol-web
I make an http request to start the session that works correctly for me.
https://i.imgur.com/14eIihC.png
But when I make the second http request to turn on the computer it gives me an error.

What is the error message (if any)?

{"status":"rejected","reason":{"message":"400 - \"{\\\"error\\\":{\\\"Inner\\\":null,\\\"Errors\\\":1},\\\"message\\\":\\\"Invalid Token\\\"}\"","name":"Error","stack":"Error: 400 - \"{\\\"error\\\":{\\\"Inner\\\":null,\\\"Errors\\\":1},\\\"message\\\":\\\"Invalid Token\\\"}\"\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:238:9)\n    at RedirectableRequest.emit (node:events:525:35)\n    at RedirectableRequest.emit (node:domain:489:12)\n    at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:356:10)\n    at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:62:10)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)\n    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n    at Socket.socketOnData (node:_http_client:534:22)\n    at Socket.emit (node:events:513:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:315:12)\n    at readableAddChunk (node:internal/streams/readable:289:9)\n    at Socket.Readable.push (node:internal/streams/readable:228:10)\n    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)"}}

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Version 0.228.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04.2 LTS

Fixed!!!

Work with postman.
I looked at the outputs when I logged in with the credentials
when logging in assigns a cookie.

Enter the cookie parameters as follows, and after 4 seconds turn on the PC
https://i.imgur.com/JcPxU9w.png

3 Likes

This solution is momentary, because the cookie has an expiration date.

Can it be made to save the cookie or token every time you log in?

Hey @diaverso,

We wouldn’t store the cookie but if you enable the full response in the http request you should be able to see the cookie in your login attempt and use that.

2 Likes

Thanks, I solved it

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.