Skip to content

Commit

Permalink
Handle early t value during Live logins
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrance committed Aug 31, 2020
1 parent 2598fe2 commit caa241e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions skpy/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,21 @@ def auth(self, user, pwd):
"""
# Do the authentication dance.
params = self.getParams()
params["opid"] = self.sendCreds(user, pwd, params)
t = self.sendOpid(params)
if isinstance(params, str):
t = params
else:
params["opid"] = self.sendCreds(user, pwd, params)
t = self.sendOpid(params)
return self.getToken(t)

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

0 comments on commit caa241e

Please sign in to comment.