'Upload media post in instagram using web api

I am using this Instagram media post third party library. When I am logged in in my Instagram account every time I am getting a checkpoint (challenge) required error how can I fix this issue.

This is the login code:

try 
{
    $response = $this->request('accounts/login/')
            ->setNeedsAuth(false)
            ->addPost('phone_id', $this->phone_id)
            ->addPost('_csrftoken', $this->client->getToken())
            ->addPost('username', $this->username)
            ->addPost('adid', $this->advertising_id)
            ->addPost('guid', $this->uuid)
            ->addPost('device_id', $this->device_id)
            ->addPost('password', $this->password)
            ->addPost('login_attempt_count', 0)
            ->getResponse(new Response\LoginResponse());
}
catch (\InstagramAPI\Exception\InstagramException $e) 
{
    if ($e->hasResponse() && $e->getResponse()->isTwoFactorRequired()) 
    {
        // Login failed because two-factor login is required.
        // Return server response to tell user they need 2-factor.
        return $e->getResponse();
    } 
    else 
    {
        // Login failed for some other reason... Re-throw error.
        throw $e;
    }
}

You can find more detail about this here :

Error Response:

message: "checkpoint_required", checkpoint_url: "https://i.instagram.com/challenge/6193546568/K2IwuBF47k/", lock: true, status: "fail", error_type: "checkpoint_challenge_required"

If you have any other way of Instagram media post then you can suggest me.



Solution 1:[1]

The above particular error looks like account specific to me. Instagram when detects malicious activity on account they lock the account, revoke the access token and you need to login again to unlock the account. They call it security check-point. Something like you were trying to access account from other country via VPN or something. Or multiple wrong password attempted.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 enator