-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Question: How to use mfa_code #203
Comments
Hi, @takabinance. MFA code is used at login time only. When you add accounts, you can specify the account's MFA code and then, if X asks for that login stap, twscrape will try to enter that code. But this process only works during login. There are several methods in twscarpe to deal with inactive accounts:
So you use it like (in command line). Try to relogin all failed accounts: twscrape relogin_failed Relogin specific accounts: twscrape relogin acc1 acc2 Or use from code: import asyncio
from twscrape import API, gather
from twscrape.models import parse_tweets
async def main():
api = API()
await api.pool.relogin(["acc1", "acc2"])
await api.pool.relogin_failed()
if __name__ == "__main__":
asyncio.run(main()) |
Interesting. I will try this. I did it in selenium and then manually updated cookies in accounts.db and was able to use the account again. But will try the built-in functionality. |
I did the following: api.pool.add_account(username, password, email, email_password, cookies, mfa_code) This worked. However, when I tried to force a login: api.pool.relogin(['mytwitteruser']) I got: Failed to login 'AllgoodMar15077': 400 - {"errors":[{"code":399,"message":"Incorrect. Please try again."}]} How can I interpret this? |
ok, so I manually went through the login (username -> email -> password -> 2fa). When I did that manually, it threw up a generic "something went wrong" modal and did not log me back in. However, I was on a VPN connection. I turned off the VPN connection and then it worked manually and also app.pool.relogin() worked as well. |
From the source code I read the mfa_code isn't the 6 digit number you type when you try to login. It's the 'secret' for generating the six digit code when you first setup 2fa, so if you are setting the 6 digits as the |
I can see there is some support to handle the main problem people seem to be having with banned accounts with login.login_two_factor_auth_challenge(). But not sure how it's connected in or how I can force its invocation. This code is way above my pay grade.
I was able to manually recover an account and updated cookies in accounts.db and then twscrape used it fine.
Does anyone know a way to invoke this and update accounts? I can probably hack together some Selenium thing but would rather not.
The text was updated successfully, but these errors were encountered: