Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loginWithCookies started giving "Please login with instagram credentials" error #350

Open
deepvision7 opened this issue Jan 2, 2023 · 4 comments

Comments

@deepvision7
Copy link
Contributor

deepvision7 commented Jan 2, 2023

Both methods to login with cookies (manual or from cache) stopped working. After using the either one it gets "Please login with instagram credentials" error now. Login with credentials works fine.

/** 1. Get cookies from file */
$sessionId = $cachePool->getItem(Session::SESSION_KEY . '.' . CacheHelper::sanitizeUsername($credentials->getLogin()))
                       ->get()
                       ->getCookieByName('sessionId');

// Generate CookieJar from instagram cookie 'sessionid'
$cookieJar = new CookieJar(false, [$sessionId]);

/** 2. Insert cookies manually
$sessionId = new SetCookie([
    "Name"     => "sessionid",
    "Value"    => "YOUR_INSTAGRAM_SESSIONID",
    "Domain"   => ".instagram.com",
    "Path"     => "/",
    "Expires"  => "YOUR_INSTAGRAM_SESSIONID_EXPIRES",
    "Max-Age"  => "31536000",
    "Secure"   => true,
    "Discard"  => false,
    "HttpOnly" => true,
]);
// Generate CookieJar from instagram cookie 'sessionid'
$cookieJar = new CookieJar(false, [$sessionId]);
*/
@proxyswitch
Copy link

Same Issue After Using One Time Login With Cookies . Instagram Deleting All Session - And Logging Out All Sessions !!

Any Solution ?

@deepvision7
Copy link
Contributor Author

deepvision7 commented Jan 20, 2023

I tried to use pr #330 but still the same issue. After successful login with credentials and attempting to login with cookies after that I still get Please login with instagram credentials from Instagram

@deepvision7
Copy link
Contributor Author

Works fine if I comment out the following code in the src/Instagram/Auth/Login.php starting at 154.

            if (!isset($data->config->viewer) && !isset($data->config->viewerId)) {
                throw new InstagramAuthException('Please login with instagram credentials.');
            }

@AgentSmith0
Copy link

@pgrimaud Is it possible to implement the solution by deepvision7, which works fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants