What's the recommended way to login?
See original GitHub issueGeneral Question
Read the Notes and fill out the form.
Switch to Preview
for reading.
Notes
Your issue will be closed if you violate any rule below.
- You need to include a meaningful descriptions and e.g. a screenshot.
- You do not include screenshots of your code.
- Read the Docs.
- Capturing endpoints and similar can be found here (read it if you are going to ask about it).
- You can delete this section after reading it.
Form
Put an [x]
if you meet the condition, else leave [ ]
.
- I’ve searched the Issues
- I’ve read the basic concepts
- I’m using the latest version
Question
A specific question, so it’s understandable to anyone. You may add pictures.
YOUR QUESTION HERE Hi everyone, I’m new here. I found this great module after some search and I tested it, I can’t say anything accept “perfect! nice work!”. I know that my account can get banned while using this module in the wrong way, so I want to know what’s the correct and the recommended way to login. I checked some examples but everything is writen in typescript, and I only know js. I know about saving session and similar things, and I should set limits for requests to avoid spam… This is what I did for now:
require("dotenv");
const { IgApiClient } = require("instagram-private-api");
const ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
async function IgLogin(){
await ig.account.login(process.evn.IG_USERNAME, process.evn.IG_PASSWORD);
}
And thx.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5
Top GitHub Comments
The session example should contain the reccomended way. You don’t have to log in after loading the session so you can wrap it in an else {…}. You can also call
ig.simulate.pre/postLoginFlow()
before and after logging in.TypeScript is a superset of JavaScript. The examples there will often translate 1:1 to JavaScript (except the type annotations e.g.
function(a: string): number
“translates” tofunction(a)
and node doesn’t yet have ESModules soimport {a} from 'b'
would beconst {a} = require('b')
)Right, although nothing is perfect.