I’m trying for so long to connect Twitter in N8N, i did it with oauth1 but when i try to post a tweet i get this error. Booth, HTTP request and Twitter Node get the same error.
OAUTH1 Error:
{"status":"rejected","reason":{"message":"401 - \"{\\n \\\"title\\\": \\\"Unauthorized\\\",\\n \\\"type\\\": \\\"about:blank\\\",\\n \\\"status\\\": 401,\\n \\\"detail\\\": \\\"Unauthorized\\\"\\n}\"","name":"Error","stack":"Error: 401 - \"{\\n \\\"title\\\": \\\"Unauthorized\\\",\\n \\\"type\\\": \\\"about:blank\\\",\\n \\\"status\\\": 401,\\n \\\"detail\\\": \\\"Unauthorized\\\"\\n}\"\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 TLSSocket.socketOnData (node:_http_client:534:22)\n at TLSSocket.emit (node:events:513:28)\n at TLSSocket.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 TLSSocket.Readable.push (node:internal/streams/readable:228:10)\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)"}}
OAUTH2
I also tryded to connect by oauth2. I can see the conection screen, but when i try to connect i get a error message.
Hi @dunoxx, I am so sorry for the trouble. The n8n Twitter node and the credentials it uses are in urgent need of an update, but unfortunately I do not have any ETA for this right now.
I tried connecting with OAuth1 which previously worked for me (described here), but this now also fails. So I think with the recent changes at Twitter and the overdue updates on our side I don’t have any great suggestion.
It might still be worth re-testing this from time to time though and playing with your exact parameters. @hrsdimitrov appears to have had some success with the generic authentication overe here (so pretty much the thing now failing for me):
@MutedJam, I’m very new to this whole space, and I’m having a similar issue with connecting to Twitter, although I’m getting a different error message. When I try to authorise the app, it says that ‘local host refuses to connect’.
Do you know if this is because of the same issue? Or do I have to change something else in my settings?
Hi @Fran_Palokaj, welcome to the community. This looks like your n8n instance isn’t listening on localhost port 5678. Are you running your n8n instance locally? If not, you might need to provide the correct URL to n8n via the WEBHOOK_URLenvironment variable. If your n8n instance is listening under https://n8n.franpalokaj.com for example, you’d need to set WEBHOOK_URL=https://n8n.franpalokaj.com/ .
@MutedJam I’ve tried adding the environment variable to my deployment on Railway.app. Afterwars, I tried connecting the Gmail API, but it said that I didn’t comply with the OAUTH rules Google has set.
When I removed the variable I no longer got this error, but I once again got the “couldn’t connect” error, that I got last time. Do you have any idea what I should change?
Unfortunately I am not familiar with railway. Is it perhaps serving n8n via an insecure (http) connection rather than https? Quite a few services require https for everything other than localhost, so this might be why Google complains.
As for the WEBHOOK_URL variable, make sure to include the protocol, so something like WEBHOOK_URL=https://n8n-production-59fe.up.railway.app/
Please do let me know if you’re still having any trouble after looking into these points
I played around for an hour, and finally figured out the solution. There were multiple variables that needed to be changed, and I found them in this blog article: Hosting n8n for Free with Railway
Also attached a screenshot with the most important info:
So I checked my settings and I think my Twitter app setup is correct. I regenerated the client secret but still get the 401 error when trying to connect the account.
I’m not sure what you mean, but I run a docker instance. Is that what you need to know?