Instagram-private-api: AuthenticationError: Login required to process this request after successful challenge

Created on 5 Aug 2018  路  12Comments  路  Source: dilame/instagram-private-api

Hello. I get "AuthenticationError: Login required to process this request" after I try to follow one random person after successful challenge. Is there anyone experiencing the same problem? The thing is, that when I tried this about one month before, It was working fine. Some instagram/cookies changes?

Most helpful comment

I have same issue.
Deleting cookie file doesn't work.

All 12 comments

I have same issue.
Deleting cookie file doesn't work.

i have similar issues but not always, so when it happends i use a backup of first successful cookies

@checho221 what if the error occurs first login...?

@lx5475 i does not happends to me, unless wrong password

Absolutely the same issue.

Same issue here, i can't login any account anyway
Asking for challenge again and again...

Once bypass the challenge, we can get cookie sessionid, mid, csrftoken, and ds_user_id.

I made my own instagram api request like/follow/comment using that cookie properties, it's work.
actually my API signIn again internally (not using the cookies acquired from this library)
but I use huttarichard/instagram-private-api to bypass the challenge.

requestLike(mediaId) {
        return new Promise((resolve, reject) => {
            var headers = this.getCommonHeaders();
            headers["cookie"] = this.getRequestCookie();
            request.post({
                headers: headers,
                uri: INSTAGRAM_ROOT + '/web/likes/' + mediaId + '/like/'
            }, (err, res, body) => {
                try {
                    let error = this.authenticate(res, body);
                    if (err || error) return reject(err || error);
                    return resolve(res.statusCode == 200);
                } catch (err) {
                    return reject(err);
                }
            });
        });
    }
getCommonHeaders() {
        var header = {};
        header["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
        header["accept-encoding"] = "deflate";
        header["accept-language"] = "ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4";
        header["origin"] = INSTAGRAM_ROOT;
        header["referer"] = INSTAGRAM_ROOT;
        header["user-agent"] = " ";
        header["x-instagram-ajax"] = "1";
        header["x-requested-with"] = "XMLHttpRequest";
        header["x-csrftoken"] = this.cookie["csrftoken"];
        return header;
    }

Hey guys, I was facing the same error.
I was able to fix it forcing a login before any follow / comment / like action

let session = await Client.Session.create(device, storage, account.name, account.password);
await Client.Session.login(session, account.name, account.password);
let relation = await Client.Relationship.create(session, userId);

Hey guys, I was facing the same error.
I was able to fix it forcing a login before any follow / comment / like action

let session = await Client.Session.create(device, storage, account.name, account.password);
await Client.Session.login(session, account.name, account.password);
let relation = await Client.Relationship.create(session, userId);

I've tried that, and I got this error:
CheckpointError: Instagram call checkpoint for this action!

So what should I do now?

guys, I have fixed this issue in my PR #567 and I am using this fix fine on my fork here https://github.com/ifedapoolarewaju/instagram-private-api/tree/fix-challenge-issue

How can I use this?
How solve the issue? Just passing the challenge?

just use the checkpoint API the way it was already documented (but this time you are using the fork instead, or the commit to this PR https://github.com/huttarichard/instagram-private-api/pull/567), and you won't get the error anymore

Was this page helpful?
0 / 5 - 0 ratings

Related issues

endquote picture endquote  路  12Comments

zalkanorr picture zalkanorr  路  12Comments

LouenLeoncoeur picture LouenLeoncoeur  路  12Comments

iMrDJAi picture iMrDJAi  路  34Comments

MMrR0b0TT picture MMrR0b0TT  路  18Comments