Skip to content

Commit

Permalink
Sequential login for 2FA accs
Browse files Browse the repository at this point in the history
  • Loading branch information
LeagueOfPoro committed Jan 30, 2023
1 parent eb499b5 commit 8f89c91
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ def login(self, username: str, password: str, refreshLock) -> bool:
self.client.get(
"https://login.leagueoflegends.com/?redirect_uri=https://lolesports.com/&lang=en")
self.__loadCookies()
# Submit credentials
data = {"type": "auth", "username": username,
"password": password, "remember": True, "language": "en_US"}
res = self.client.put(
"https://auth.riotgames.com/api/v1/authorization", json=data)
resJson = res.json()
try:
refreshLock.acquire()
# Submit credentials
data = {"type": "auth", "username": username,
"password": password, "remember": True, "language": "en_US"}
res = self.client.put(
"https://auth.riotgames.com/api/v1/authorization", json=data)
resJson = res.json()
if "multifactor" in resJson.get("type", ""):
refreshLock.acquire()
twoFactorCode = input(f"Enter 2FA code for {self.account}:\n")
refreshLock.release()
print("Code sent")
data = {"type": "multifactor", "code": twoFactorCode, "rememberDevice": True}
res = self.client.put(
"https://auth.riotgames.com/api/v1/authorization", json=data)
Expand All @@ -67,6 +67,8 @@ def login(self, username: str, password: str, refreshLock) -> bool:
res = self.client.get(resJson["response"]["parameters"]["uri"])
except KeyError:
return False
finally:
refreshLock.release()
# Login to lolesports.com, riotgames.com, and playvalorant.com
token, state = self.__getLoginTokens(res.text)
if token and state:
Expand Down

0 comments on commit 8f89c91

Please sign in to comment.