Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit caa241e

Browse files
committed
Handle early t value during Live logins
1 parent 2598fe2 commit caa241e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

skpy/conn.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,21 @@ def auth(self, user, pwd):
564564
"""
565565
# Do the authentication dance.
566566
params = self.getParams()
567-
params["opid"] = self.sendCreds(user, pwd, params)
568-
t = self.sendOpid(params)
567+
if isinstance(params, str):
568+
t = params
569+
else:
570+
params["opid"] = self.sendCreds(user, pwd, params)
571+
t = self.sendOpid(params)
569572
return self.getToken(t)
570573

571574
def getParams(self):
572575
# First, start a Microsoft account login from Skype, which will redirect to login.live.com.
573576
loginResp = self.conn("GET", "{0}/oauth/microsoft".format(SkypeConnection.API_LOGIN),
574577
params={"client_id": "578134", "redirect_uri": "https://web.skype.com"})
578+
tField = BeautifulSoup(loginResp.text, "html.parser").find(id="t")
579+
if tField is not None:
580+
# We've already got an existing session, no further steps needed.
581+
return tField.get("value")
575582
# This is inside some embedded JavaScript, so can't easily parse with BeautifulSoup.
576583
ppftReg = re.search(r"""<input.*?name="PPFT".*?value="(.*?)""" + "\"", loginResp.text)
577584
if not ppftReg:

0 commit comments

Comments
 (0)