Comments (6)
@gutosanches, I may have solved that problem with:
await client.updateChallenge({challengeUrl, choice: 1});
await client.updateChallenge({ challengeUrl, securityCode: 'VERIFICATION_CODE_FROM_EMAIL'});
In my case I need to update Challenge with security code from Instagram email.
Full code (TS):
public async login(): Promise<Instagram> {
const client = new Instagram({username: this.username, password: this.password});
try {
await client.login();
} catch (err) {
if (err.error && err.error.message === 'checkpoint_required') {
const challengeUrl = err.error.checkpoint_url;
await client.updateChallenge({challengeUrl, choice: 1});
await client.updateChallenge({ challengeUrl, securityCode: '301794'}); // <== securityCode - set code from email.
}
}
return await client;
}
Notes:
- I use Gmail email for Instagram.
- I use imap-simple for getting the Security code from Instagram Email.
from instagram-web-api.
I spent a lot of time with these challenges in order to figure out the appropriate way to use the API. First, you'll need to save the challengeUrl
returned from the login form. I then use getChallenge
to get the challenge JSON object. From there you can read the challengeType
which will determine what do to. Here's the challengeTypes that I found:
SelectVerificationMethodForm
This is the form you see asking you whether to send the verification via email or mobile text. UseupdateChallenge
to set the choice, and after invocation, the verification email/text will be sent.VerifyEmailCodeForm
This is the form you see when asking for the verification code from email. This doesn't require a choice when callingupdateChallenge
(in fact, I believe it will give an error). Instead, send thesecurityCode
with theupdateChallenge
invocation. If no security code was sent, you can usereplayChallenge
to have the security code sent again.
There may be other challengeTypes worth documenting, but these are enough to get a working challenge passing algorithm started. I would log any other challenge types that aren't handled by your app, and share them with some context so we can all figure out what they mean and document them.
Cheers!
from instagram-web-api.
I'm trying to implement the flow suggested above ^ but I'm also getting that same This page could not be loaded.
error (and also in HTML) when trying to call updateChallenge
. Opening the challengeUrl on the browser directly shows the verification page as expected.
Anyone ran into this too and figured it out?
Here's what I'm doing:
- Try to login
- Get error with
challenge_url
- Call
updateChalenge
usingchallengeUrl
and choice 1 for email, as suggested - Get error
This page could not be loaded
from instagram-web-api.
I am using "imap-simple" to pick up the security code, but it is still returning error 400 :((
Google translate :D
export const getClientInstagram = async ({usuario, senha, cookie}) => {
const contaRepository = getCustomRepository(ContaRepository);
const client = new Instagram({
username: usuario,
password: senha,
cookies: cookie
}, {language: 'pt-BR'});
try{
const t = await client.login();
await contaRepository.setCookiePorUsuario(usuario, t.cookies);
}catch (err) {
if (err.error && err.error.message === 'checkpoint_required') {
const codigoSeguranca = await getCodigoSeguranca(usuario);
if(codigoSeguranca) {
const challengeUrl = err.error.checkpoint_url;
await client.updateChallenge({challengeUrl, choice: 1});
await client.updateChallenge({challengeUrl, securityCode: codigoSeguranca});
}
}
}
return client;
}
from instagram-web-api.
Same Problem. Getting 400 checkpoint_required
error messages.
My app runs in a Docker container, so I haven't figured out a way to read the security code from outside and then insert it into client.updateChallenge
.
Any help/suggestions are appreciated.
from instagram-web-api.
Same Problem. Getting
400 checkpoint_required
error messages.My app runs in a Docker container, so I haven't figured out a way to read the security code from outside and then insert it into
client.updateChallenge
.Any help/suggestions are appreciated.
Are there any decisions after more than one year?)
from instagram-web-api.
Related Issues (20)
- Is it possible to upload videos? HOT 1
- Search users by biography HOT 2
- Is `getUserByUsername` method return `userId`? HOT 1
- RequestError: Error: getaddrinfo EAI_AGAIN www.instagram.com
- How to retrieve other profiles information? HOT 1
- "authenticated": false" when client.login HOT 4
- getUserByUsername() is getting error HOT 2
- ‘StatusCodeError: 405 - undefined’ on `client.logout()`
- Always getting code 429 HOT 1
- Cannot read properties of undefined ( reading "hastag") HOT 1
- How do you fetch all followers
- Login is erroring (_sharedData) HOT 35
- Instagram insights
- Blocking accounts. Is there a solution?
- FEATURE | Encrypt login
- Is this Libarary unusable now? HOT 13
- login failed: TypeError: Cannot read properties of null (reading '0') HOT 3
- Cannot read properties of null (reading '0') HOT 15
- getUserByUsername not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instagram-web-api.