question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instagram.sessionId is undefined every time.

See original GitHub issue

Does this package still work for anyone?

Here is a (slightly changed) example from the README:

Instagram.getCsrfToken()
  .then((csrf) => {
    Instagram.csrfToken = csrf;
  })
  .then(() => {
    return Instagram.auth(this.config.username, this.config.password).then(
      (sessionId) => {
        console.log(sessionId); // undefined
        Instagram.sessionId = sessionId;

	    // ...
      }
    );
  })
  .catch(console.error);

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Thibaultfqcommented, Jan 4, 2021

https://github.com/yatsenkolesh/instagram-nodejs/blob/4c847a668329ae61c42d2bdfc0b8d282397e565d/instagram.js#L285-L291

The auth() method is always returning a 404 Bad Request reply. SessionId is never set due to this issue. So this package is not updated to the current auth method required by IG.

Any references or documentation on the new auth method and url? I assume this is now done use GraphQL? Maybe i could open another pull request if i get this to work.

Current workaround: copy your csrf and sessionid cookies from the instagram.com page after using their official login and use these in this API.

      const  instagram = new Instagram();
      instagram.csrfToken = cookies.csrf;
      instagram.sessionId = cookies.sessionid;
1reaction
Mrjavacicommented, Jul 2, 2020

I have the same problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: sessionID is not defined · Issue #53 - GitHub
I had this issue when run the basic code: ReferenceError: sessionID is not defined at Instagram.auth.then ...
Read more >
session id shows as undefined node.js - Stack Overflow
I am trying to setup authenticated socket calls to match sockets with each user. I have this code that does it for the...
Read more >
Use an alternative login method using the SessionID cookie
The iMediamatic plugin was updated, now it is also able to use the SessionID Instagram cookie to log in. For details, watch this...
Read more >
How to get Instagram session ID - CyberSEO Pro
Your session ID will be valid for all the time you are logged into Instagram, so don't logout. If you don't want to...
Read more >
Error: Cannot read properties of undefined (reading 'cometd ...
sessionId = data; this.error = undefined; loadScript(this, cometdlwc).then(() => { console.log('script loaded yippie!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found