sekai-soft / guide-nitter-self-hosting

A guide for self-hosting a Nitter instance
MIT License
154 stars 8 forks source link

Auth failure with docker-compose example #21

Open pypeaday opened 2 months ago

pypeaday commented 2 months ago

I'm working on setting up self-hosted nitter so that I can use ArchiveBox to archive tweets

I've copied the docker-compose with one change that I think should be irrelevant to the functionality (I am a fairly experienced containers user for what that's worth)

Here's my compose

name: nitter-only

services:
  nitter:
    image: ghcr.io/sekai-soft/nitter-self-contained
    container_name: nitter
    ports:
      - "8095:8080"  # changed this bit due to existing workloads
    volumes:
      - nitter-data:/nitter-data
    depends_on:
      nitter-redis:
        condition: service_healthy
    environment:
      - NITTER_ACCOUNTS_FILE=/nitter-data/guest_accounts.json
      - DISABLE_REDIS=1
      - REDIS_HOST=nitter-redis
    env_file:
      - .env
    restart: unless-stopped
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:8080 || exit 1
      interval: 5s
      timeout: 5s
      retries: 12
  nitter-redis:
    image: redis:6-alpine
    container_name: redis
    command: redis-server --save 60 1 --loglevel warning
    volumes:
      - nitter-redis:/data
    restart: unless-stopped
    healthcheck:
      test: redis-cli ping
      interval: 5s
      timeout: 5s
      retries: 12
volumes:
  nitter-data:
  nitter-redis:

And then my env file

DEBUG=1
TWITTER_USERNAME=aMyBurner
TWITTER_PASSWORD=TheCorrectPasswordThatIHaveVerifiedSeveralTimes

INSTANCE_RSS_PASSWORD=madethisup
INSTANCE_WEB_USERNAME=madethisuptoo
INSTANCE_WEB_PASSWORD=madethisupaswell

INSTANCE_TITLE=Custom title
INSTANCE_THEME=Twitter Dark
INSTANCE_INFINITE_SCROLL=1
INSTANCE_HOSTNAME=

TS_AUTHKEY=tskey-auth

TWITTER_HANDLE=
MASTODON_HOST=
MASTODON_CLIENT_ID=
MASTODON_CLIENT_SECRET=
MASTODON_ACCESS_TOKEN=
BSKY_HANDLE=
BSKY_PASSWORD=

And finally the logs which are just full of auth failures?

Dumping auth env...

Dumping custom path env...

Dumping redis connection env...

Dumping instance customization env...

Dumping instance guardian env...

Writing Procfile...

]0;src | overmindsystem | Tmux socket name: overmind-src-Zgnr9B15s8R3rdEkpSSzj

system | Tmux session ID: src

system | Listening at ./.overmind.sock

web    | Started with pid 22...

nginx  | Started with pid 23...

web    | Running auth...

nginx  | Running gen_nginx_conf...

nginx  | Launching nginx...

web    | DEBUG:root:TW_ANDROID_BASIC_TOKEN=Basic M25WdVNvQlpueDZVNHZXc6QmNzNTlFRmJic2RGNlNsOU5nNzFzbWdTdFdFR3dYWZ0N3==

web    | DEBUG:root:start auth

web    | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com:443

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /oauth2/token HTTP/11" 200 152

web    | DEBUG:root:bearer_token=bearer AAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gd74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDe2jpGskWD

web    | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com:443

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/guest/activate.json HTTP/11" 200 63

web    | DEBUG:root:guest_token=1836760313141620790

web    | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com:443

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json?flow_name=login&api_version=1&known_device_token=&sim_country_code=us HTTP/11" 200 551

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 200 550

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 200 460

web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 403 98

web    | Failed authentication. You might have entered the wrong username/password. Please rerun with environment variable DEBUG=1 for debugging.

web    | Exited with code 1

nginx  | Interrupting...

nginx  | Exited with code 0

note: I mucked with the bearer token when I pasted the logs because I actually don't really know if it matters

AritzUMA commented 2 months ago

Check with another account

pypeaday commented 2 months ago

I just tried with my main twitter account and the same thing happened

I forgot to mention that I do get an email that a new login was detected - it says if it was me that I don't need to take any action so I assume it's just that each auth request looks like a new device to twitter. But the email certainly makes me think that there's another issue behind the Failed authentication exception

pdwalker commented 2 months ago

I seem to be having the same issue. Is the api being blocked, or maybe it is blocked from certain countries?

AritzUMA commented 2 months ago

Can you check with a VPN?

pdwalker commented 2 months ago

Can you check with a VPN?

I ran a new instance from a virtual machine in the US (linode) and I get the same result as when I try to run it locally (HK).

I have also tried with a new account in both locations. Again, the error is the same.

pdwalker commented 2 months ago

from the docker logs with a correct username/password

web    | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com:443
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json?flow_name=login&api_version=1&known_device_token=&sim_country_code=us HTTP/11" 200 546
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 200 540
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 200 455
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 403 98
web    | Failed authentication. You might have entered the wrong username/password. Please rerun with environment variable DEBUG=1 for debugging.

and when I put in correct username/wrong password:

web    | DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com:443
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json?flow_name=login&api_version=1&known_device_token=&sim_country_code=us HTTP/11" 200 547
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 200 540
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 400 78
web    | DEBUG:urllib3.connectionpool:https://api.twitter.com:443 "POST /1.1/onboarding/task.json HTTP/11" 400 105
web    | Failed authentication. You might have entered the wrong username/password. Please rerun with environment variable DEBUG=1 for debugging.
RunlevelConsulting commented 1 month ago

I'm also having the same problem, my username and password are definitely correct. I thought it might be because the server I was running the docker container on was from a different IP than the initial registration or because it's a different machine trying to log in.

So I set up a VPN on the nitter server and registered a new account, but no, same problem as above.

KTachibanaM commented 1 month ago

Updated repo and it should be fixed now.

pypeaday commented 1 month ago

I'm afraid I don't see the change... the most recent repo update or action was 3 months ago?

Danijel-Enoch commented 1 month ago

https://github.com/sekai-soft/nitter

he fixed it here

Danijel-Enoch commented 1 month ago

@KTachibanaM not fixed bro

![Uploading Screenshot 2024-10-04 at 04.38.51.png…]()

RunlevelConsulting commented 1 month ago

Can't see your image but the repo update worked for me. I did have a brief issue where I was getting 'User not found' and 'Tweet not found' but that was because Twitter had locked the acocunt, I logged on, completed the Captcha and everything works great.

Danijel-Enoch commented 1 month ago

okay thanks

Danijel-Enoch commented 1 month ago

let me check my account

P-Bauer commented 2 weeks ago

Has this been resolved? If so how and what steps did you take.

KTachibanaM commented 1 week ago

If auth keeps failing for you maybe try the multiple accounts approach where username and passwords are passed in via a file instead of env vars (there could be weird .env file issues where credentials strings are cut off due to escaping) https://github.com/sekai-soft/guide-nitter-self-hosting/blob/master/docs/server.md#multiple-twitter-accounts

pypeaday commented 5 days ago

the updated compose works for me, thanks!

I'll close when I get up to a computer 👍