Instagram-private-api: AuthenticationError fix doesn't work

Created on 3 Dec 2018  路  7Comments  路  Source: dilame/instagram-private-api

Lately I have been tackling this issue. I saw a lot of other people complaining about this. Some say they managed to fix it and some that don't.
I saw there was a merge recently claiming to fix this but after I installed the newest version of the API it seems that the issue persists.
After completing the challenge successfully I attempt to login once more and it works, when attempting to like a user I get this to the console:

AuthenticationError {name: "AuthenticationError", message: "Login required to process this request"}

Anyone has an idea how to fix this?

Most helpful comment

Hey,
To everyone that tackles this in the future I managed to get it working.
This problem was fixed in version 0.7, but you can't get it from NPM yet.
If you will install this library with npm you will get 0.6.8(At this moment of writing this).
to download the specific updated working version try to add this to package.json:

"instagram-private-api": "git://github.com/huttarichard/instagram-private-api#0.7.0"

and run npm install afterwards.
This way the module will be installed directly from github and not from NPM.

All 7 comments

Need a full example of bug to reproduce

Same problem with the example from the README.md.
I always have to do the phone challenge, why?
Then when I pass the challenge, I always have this error when I try to follow:
Unhandled rejection AuthenticationError: Login required to process this request

Here the code:

// var device, storage, user, password;
// you get those from previous examples

function challengeMe(error){
    return Client.Web.Challenge.resolve(error,'phone')
        .then(function(challenge){
            // challenge instanceof Client.Web.Challenge
            console.log(challenge.type);
            // can be phone or email
            // let's assume we got phone
            if(challenge.type !== 'phone') return;
            //Let's check if we need to submit/change our phone number
            return challenge.phone('79876543210')
                .then(function(){return challenge});
        })
        .then(function(challenge){
            // Ok we got to the next step, the response code expected by Instagram
            return challenge.code('123456');
        })
        .then(function(challenge){
            // And we got the account confirmed!
            // so let's login again
            return loginAndFollow(device, storage, user, password);
        })
}


function loginAndFollow(device, storage, user, password) {
    return Client.Session.create(device, storage, user, password)
        .then(function(session) {
            // Now you have a session, we can follow / unfollow, anything...
            // And we want to follow Instagram official profile
            return [session, Client.Account.searchForUser(session, 'instagram')]   
        })
        .spread(function(session, account) {
            return Client.Relationship.create(session, account.id);
        })
}


loginAndFollow(device, storage, user, password)
    .catch(Client.Exceptions.CheckpointError, function(error){
        // Ok now we know that Instagram is asking us to
        // prove that we are real users
        return challengeMe(error);
    }) 
    .then(function(relationship) {
        console.log(relationship.params)
        // {followedBy: ... , following: ... }
        // Yey, you just followed an account
    });

I am facing the same issue

Hey,
To everyone that tackles this in the future I managed to get it working.
This problem was fixed in version 0.7, but you can't get it from NPM yet.
If you will install this library with npm you will get 0.6.8(At this moment of writing this).
to download the specific updated working version try to add this to package.json:

"instagram-private-api": "git://github.com/huttarichard/instagram-private-api#0.7.0"

and run npm install afterwards.
This way the module will be installed directly from github and not from NPM.

@Jordanh1996 @dilame I took the last version (on github https://github.com/dilame/instagram-private-api/), run "npm install" in the "instagram-private-api" folder, and it works now. Thanks!

@Jordanh1996 ty my friend, good job dude :dancer:

Was this page helpful?
0 / 5 - 0 ratings