Unable to connect to Twitter API

I’m trying to set up a connection with the Twitter API, entered all the keys and secrets, I get:

OAuth Authorization Error
There was a problem generating the authorization URL
Client network socket disconnected before secure TLS connection was established

My settings that I think might affect this are:

NGINX

# http -> https
server {
  listen 80;
  server_name n8n.mydomain.com;
  rewrite ^(.*) https://$host$1 permanent;
}
server {
  listen 443 ssl;
   listen [::]:443 ssl;
    server_name n8n.mydomain.com;
  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;

# SSL parameters
  ssl_certificate /etc/ssl/nginx/n8n.mydomain.com.pem;
  ssl_certificate_key /etc/ssl/nginx/n8n.mydomain.com.key;
  ssl_session_timeout 30m;
  ssl_protocols       TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_prefer_server_ciphers off;

    location / {
        proxy_pass http://my_ip:5678;
        proxy_http_version 1.1;
        proxy_set_header Connection '';
        proxy_set_header Host $host;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
    }
}

and pm2 ecosystem.config.js

module.exports = {
    apps : [{
        name   : "n8n",
        env: {
            N8N_BASIC_AUTH_ACTIVE:true,
            N8N_BASIC_AUTH_USER:"my_email",
            N8N_BASIC_AUTH_PASSWORD:"my_password",
            N8N_HOST: "n8n.mydomain.com",
            N8N_PROTOCOL: "https",
            VUE_APP_URL_BASE_API: "https://n8n.mydomain.com/",
            WEBHOOK_TUNNEL_URL: "https://n8n.mydomain.com/",
            WEBHOOK_URL: "https://n8n.mydomain.com/",
            GENERIC_TIMEZONE: "Europe/Berlin"
        }
    }]
}

VPS, Ubuntu 22.04, NGINX, npm, pm2, SSL by CloudFlare
n8n -v
0.226.2

Could you help, please

Hi @cuman, welcome to the community and sorry for the trouble.

Your config looks good to me, though I am not an nginx expert. We have an open GitHub issue for the problem you hae reported though which you might want to follow: Twitter authentication isn't working on Docker Image - Railway.app · Issue #4897 · n8n-io/n8n · GitHub

I sure hope we’ll release an updated node soon, though I do not have an ETA yet unfortunately.

1 Like

Finaly the original question was solved by VPN from Cloudflare (zero trust). This error was caused by the fact that Twitter is blocked in our country

I implemented the publication of tweets through oauth 1 and api 2

But only text, I couldn’t post pictures from rss along with text

2 Likes

Ah sweet, glad to hear you figured out the connection part!

Posting an image should work as described here using the HTTP Request node.

1 Like

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