dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.99k stars 1.14k forks source link

You've Been Logged Out #1080

Closed redraw closed 4 years ago

redraw commented 4 years ago

Form

Put an [x] if you meet the condition, else leave [ ].

Requirements

Description

I'm trying to login into my account from a script inside a VPS outside my country. Each time I try to login, a splash screen on the IG app shows up where I check "It was me".

I am given a challenge and receive an SMS. After I send the challenge code, I'm logged out again.

Here's my code: https://gist.github.com/redraw/37d077f6d71f320649923a58fa8c9ecb#file-run-js-L30

And here's what I get (with DEBUG=ig:*)

  ig:request Requesting POST /api/v1/challenge/***********/RIJTmgcZsr/ +588ms                                                                                  [1626/1806]
[13.02.2020 01:29.24.804] [LOG]   checkpoint { message: 'challenge_required',                                                                                            
  challenge:                                                                                                                                                             
   { url: 'https://i.instagram.com/challenge/***********/RIJTmgcZsr/',                                                                                                    
     api_path: '/challenge/***********/RIJTmgcZsr/',                                                                                                                      
     hide_webview_header: true,                                                                                                                                          
     lock: true,                                                                                                                                                         
     logout: false,                                                                                                                                                      
     native_flow: true },                                                                                                                                                
  status: 'fail',                                                                                                                                                        
  error_type: 'checkpoint_challenge_required' }                                                                                                                          
[13.02.2020 01:29.24.808] [LOG]   challenge { step_name: 'verify_code',                                                                                                  
  step_data:                                                                                                                                                             
   { security_code: 'None',                                                                                                                                              
     sms_resend_delay: 60,                                                                                                                                               
     phone_number_preview: '1785',                                                                                                                                       
     resend_delay: 60,                                                                                                                                                   
     contact_point: '1785',                                                                                                                                              
     form_type: 'phone_number',                                                                                                                                         
     phone_number_formatted: '+54 * *** ***-1785',                                                                                                                       
     phone_number: '+54 * *** ***-1785' },                                                                                
  user_id: **********,                                                                                                                                                   
  nonce_code: 'RIJTmgcZsr',                                                                                                                                              
  status: 'ok' }                                                                                                                                                        
? Challenge code 615738                                                                                                                                                 
  ig:request Requesting POST /api/v1/challenge/**********/RIJTmgcZsr/ +6m                                 
[13.02.2020 01:35.46.167] [LOG]   { action: 'close', status: 'ok' }                                                                                                      
[13.02.2020 01:35.46.169] [LOG]   challenge null                                                                                                                         
  ig:request Requesting undefined /api/v1/friendships/pending +2s                                                                                                       
  ig:request Request GET [object Object] failed: {"message":"login_required","error_title":"You've Been Logged Out","error_body":"Please log back in.","logout_reason":2$
"status":"fail"} +151ms                                                                                                                                                  
[13.02.2020 01:35.46.339] [ERROR] IgLoginRequiredError: GET /api/v1/friendships/pending/?rank_token=481579f8-faaf-534a-ad59-718075570a87 - 403 Forbidden

If I send a wrong challenge code, I get an error like this,

  ig:request Requesting POST /api/v1/challenge/***********/ePjtVmnoSp/ +55s                                 
  ig:request Request POST [object Object] failed: {"message":"Please check the code we sent you and try again.","status":"fail"}

Most of the time, after failing, I try again and I get this 502 error.

[13.02.2020 01:44.21.140] [ERROR] IgResponseError: POST /api/v1/accounts/login/ - 502 Bad Gateway;
    at Request.handleResponseError (/home/ubuntu/instaccept/node_modules/instagram-private-api/src/core/request.ts:171:12)
    at Request.send (/home/ubuntu/instaccept/node_modules/instagram-private-api/src/core/request.ts:82:24)
    at <anonymous>
Ektaros commented 4 years ago

Same here

Nerixyz commented 4 years ago

You probably need to log in again after completing the challenge, else ➡ #1068