API Key Discussion #128
-
Hi! This is a great package with outstanding documentation. Well done and thank you for making it public! I am working on a similar project and am recently facing a new issue regarding connecting to the API. I am working with PHP, not directly your python package (though I have used your python library in the past). I'm hoping that you might have some insight to the API issue since you have been working with it quite a bit, and my issue isn't specific to PHP. Have you explored ways to grab a user's SWID and espn_s2 cookies automatically based on their ESPN login username & password? I have code that allows me to connect to the API with username & password and I am able to fetch the 2 cookies for any user. The process first grabs and API key before grabbing the cookies. Just recently the code stopped working and I am receiving an error message related to "Authorization header missing or invalid" even though the authorization header is the username & password. I don't mean for this to sound like I am asking for specific debugging help. Rather I hope to kickoff a discussion and pick your brain about if you have seen similar challenges, different approaches for grabbing a user's cookies, or any recent changes to the API that might have caused this. Best, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 12 replies
-
Hey Kyle, I'm glad you have found this package helpful and thank you for opening up a discussion! I have recently ran into the same issue with ESPN's login API via username and password. It looks like ESPN has recently updated their login authentication and added extra security. I have done some investigation looking at the API calls when logging in via the web browser and documented it here #100. I'm going to copy my findings here as I think Discussions is a better platform to talk about it than a issue ticket. I have been looking at how web authenticates and it looks like they are using google recaptcha for extra authentication. Here are the logs when I update using these endpoints url_api_key = 'https://registerdisney.go.com/jgc/v6/client/ESPN-ONESITE.WEB-PROD/api-key?langPref=en-US'
url_login = 'https://registerdisney.go.com/jgc/v6/client/ESPN-ONESITE.WEB-PROD/guest/login?langPref=en-US'
{'data': None, 'error': {'keyCategory': 'FAILURE_BY_DESIGN', 'conversationId': None, 'correlationId': '88778c0d-30bc-493f-a651-f3887f2ca1fa',
'errors': [{'code': 'AUTHORIZATION_CREDENTIALS', 'category': 'FAILURE_BY_DESIGN', 'inputName': None, 'errorId': '1c328375-ad5b-4e02-b6ac-b02f94b15d50',
'timestamp': '2020-09-09T19:21:55.675-0700',
'data': {'type': 'GenericReasonCodeErrorData', 'reasonCode': 'PALOMINO_CHECK_FAILED'}, 'developerMessage': None, 'content': None}]}} Im not sure what On the web ESPN calls google API to get a key right before the login call. The call sequence looks like this
I have also been trying to see which endpoint mobile authenticates too and see what authentication they are using. However they are now using https so I cannot see auth url path. I would love some help if anyone has any ideas or experience with google recaptcha API |
Beta Was this translation helpful? Give feedback.
-
I wanted to update here since no one seemed to follow up. The problem was the captcha solving. ESPN just recently added it and all you had to do was pass it along with the request just like before. However, they changed something else as of a few days ago and it is back to saying |
Beta Was this translation helpful? Give feedback.
-
I was also struggling with this, but I believe I have found a work-around for it. I wrote a function I tried getting I hope this helps you. I'll leave it up to you on how/where would be best to integrate this into your repo, but this was how I tackled the issue. I've linked the corresponding code in my repo, but here it is for ease:
For storing credentials:
|
Beta Was this translation helpful? Give feedback.
I was also struggling with this, but I believe I have found a work-around for it. I wrote a function
get_credentials()
that usesSelenium
to open up a browser where a user can log in (the default chrome profile is used, which may log the user in automatically if they have used espn.com recently). Theswid
andespn_s2
cookies are then fetched automatically and can be stored for future use.I tried getting
selenium
to locate the login fields, but wasn't having much luck. Ideally, this could automate this process without requiring user interaction. This could potentially improve the function.I hope this helps you. I'll leave it up to you on how/where would be best to integrate this into you…