Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESPN_2 and SWID Credentials #549

Open
josh-bone opened this issue Jul 27, 2024 Discussed in #150 · 3 comments
Open

ESPN_2 and SWID Credentials #549

josh-bone opened this issue Jul 27, 2024 Discussed in #150 · 3 comments

Comments

@josh-bone
Copy link

I'm getting an ESPNAccessDenied error every time. I tried the espn_s2 cookie as both "URL-decoded" and not. Should the SWID include curly braces?

Is it possible that ESPN changed something so that espn_s2 isn't enough? Or am I missing something when it comes to credentials? I'd love to hear from someone that is actively using the API.

Discussed in #150

Originally posted by slmroz November 19, 2020
Hi there.
First of all - great to see ESPN API project as ESPN abandoned the idea years ago.
As I can see now - they introduced additional recapcha authentication so now it's impossible to get access to private leagues using the userid and pass.
What's the easiest way to find the SWID and ESPN_S2 values? Is it stored in cookies alter the login? Does it stay the same with next sessions?

@dtcarls
Copy link
Contributor

dtcarls commented Jul 29, 2024

Active user here (and answer giver to #150 ) and working fine. Make sure you are using the latest version. You need both ESPN_S2 and SWID. SWID seems to work with or without curly braces, but I go out of my way to include them.

Make sure you are including the arguments in the right order or explicitly call them when initializing the League object.
ex.
league = League(league_id=1245, year=2024, espn_s2='ASCWDWheghjwwqfwjqhgjkjgegkje', swid='{03JFJHW-FWFWF-044G}')

The wiki has great documentation and examples

@DesiPilla
Copy link
Contributor

  1. Log into your espn fantasy football account at https://www.espn.com/fantasy/football/.
  2. Right click anywhere on the screen (Chrome browser only) and click Inspect.
  3. In the window that appears on the right, click Application on the top bar (you may have to click the dropdown arrow next to Elements, Console, Sources...).
  4. On the left, navigate to Storage > Cookies > http://fantasy.espn.com.
  5. Scroll down in the table to the right until you find SWID. Copy & paste the alphanumeric string in the the Value column (without the curly brackets).
    It should look something like: 43B70875-0C4B-428L-B608-759A4BB28FA1
  6. Next, keep scrolling until you find espn_s2. Again, copy and paste the alphanumeric string in the Value column. This code will be much longer and won't have curly brackets in it.

I haven't had any issues this year either. Are you on the latest version (v0.36.0)? It may be possible that the league hasn't been activated for the current year, which would give you permission errors.

@Ujjwal-N
Copy link

worked after i decoded by espn_s2(https://meyerweb.com/eric/tools/dencoder/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants