Search code examples
pythonoauthlive-sdk

Live Connect: Unable to refresh OAuth 2.0 token due to SSL and 404 Errors


I have a script that is using the Live Connect REST APIs to refresh an OAuth 2.0 access token. The script has been working without problems for a couple of years, but recently broke with an apparent change in Live Connect API URLs.

Originally, I used these URLs to perform OAuth authentication:

  • _https://login.live.com/oauth20_authorize.srf
  • _https://login.live.com/oauth20_token.srf

Yesterday, when attempting to run the script I received the error:

hostname 'login.live.com' doesn't match u'api.login.live.com'

So, I changed the url to "api.login.live.com" but then received a 404 during the request as _https://api.login.live.com/oauth20_token.srf doesn't seem to exist.

Interestingly, _https://login.live.com/oauth20_token.srf does yield the expected result when accessed via the browser.

Any ideas on what might be going on?

Potentially interesting data:

  • Browser is Chrome running on Windows 10
  • Script is written in Python 2.7 using the requests 1.0.4 package

(Note that my reputation doesn't allow for more than 2 links, thus the funky decoration).


Solution

  • Should someone find themselves in a similar situation, the fix was to add the parameter "verify=False" when calling requests.post.