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

[BUG] JSONDecodeError for TOTP 2FA (Google Authenticator) #687

Open
hittiks opened this issue May 30, 2022 · 7 comments
Open

[BUG] JSONDecodeError for TOTP 2FA (Google Authenticator) #687

hittiks opened this issue May 30, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@hittiks
Copy link

hittiks commented May 30, 2022

I am getting a JSONDecodeError exception when I try to perform two factor authentication with Google Authenticator.
Am I doing something wrong or has Instagram changed the API?

Traceback:

Status 200: JSONDecodeError in private_request (user_id=10342827286, endpoint=/challenge/) >>> <!DOCTYPE html> (long html...)
future: <Task finished coro=<Dispatcher._process_polling_updates() done, defined at /app/.heroku/python/lib/python3.7/site-packages/aiogram/dispatcher/dispatcher.py:407> exception=ClientJSONDecodeError('JSONDecodeError [Errno Expecting value] <!DOCTYPE html>\n<html lang="en" class="no-js logged-in client-root touch">\n <head>\n <meta charset="utf-8">\n
(long html...)
</script>\n </body>\n</html>
instagrapi.exceptions.ClientJSONDecodeError: JSONDecodeError [Errno Expecting value] <!DOCTYPE html> (long html...)
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <!DOCTYPE html> (long html...)

@hittiks hittiks added the bug Something isn't working label May 30, 2022
@adw0rd
Copy link
Contributor

adw0rd commented May 30, 2022

@hittiks it looks like instagram has changed api, can you fix it?

@adw0rd adw0rd changed the title [BUG] [BUG] JSONDecodeError for TOTP 2FA (Google Authenticator) May 30, 2022
@hittiks
Copy link
Author

hittiks commented May 30, 2022

@adw0rd No, I can't fix it

@hittiks
Copy link
Author

hittiks commented May 30, 2022

To recreate the behavior, you need to follow the link https://i.instagram.com/challenge/?next=/api/challenge/ (after 2FA)

So I tried to run that long HTML and got this page:

https://ibb.co/1GhWPyg

I am using Heroku to run my code in the cloud and passing this challenge from mobile can't solve the problem

Button "Это я" have this code (maybe it will be useful):
<button name="choice" value="0" class="_5f5mN -fzfL KUBKM yZn4P ">Это я</button>

@thmasker
Copy link

thmasker commented Jun 1, 2022

Same error for me

@hittiks
Copy link
Author

hittiks commented Jun 2, 2022

@adw0rd Well, I tried to fix it. I was able to go through that page and get {'location': 'instagram://checkpoint/dismiss', 'type': 'CHALLENGE_REDIRECTION', 'status': 'ok'} but so far I don't understand what I need to go further

@mavenium
Copy link

I have the same problem.

@diezo
Copy link

diezo commented Jan 8, 2024

a quick fix:

pip install ensta

from ensta import Host

host = Host(username, password, totp_token=token)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants