zachowj / xfinity-data-usage

Fetch Xfinity data usage and serve it via an HTTP endpoint, publish it to MQTT or post it to an URL.
https://hub.docker.com/r/zachowj/xfinity-data-usage
MIT License
54 stars 14 forks source link

No longer logging in, even though auth and cookie is successful #45

Closed janssenjones closed 3 years ago

janssenjones commented 3 years ago

This had been working fine for weeks, along with updating the pwsuffix and all, but broke in the past couple days. I've tried moving between several releases in the 13/14/15 tags, and none seem to work at the moment. It seems to successfully sign in, save a local cookie, and then fail to pull the data after going through some redirect loop or something. Hitting the URL 'https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet' in an incognito browser after logging in does seem to work:

xfinity | 2021-09-12 21:28:31 [info] : Connected to MQTT xfinity | 2021-09-12 21:28:31 [verbose] : Fetching Data xfinity | 2021-09-12 21:28:31 [debug] : Loading (https://customer.xfinity.com) xfinity | 2021-09-12 21:28:36 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:36 [debug] : Logging in xfinity | 2021-09-12 21:28:39 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:39 [debug] : Saving cookies for next fetch xfinity | 2021-09-12 21:28:39 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet xfinity | 2021-09-12 21:28:40 [debug] : Not logged in xfinity | 2021-09-12 21:28:40 [debug] : Loading (https://customer.xfinity.com) xfinity | 2021-09-12 21:28:43 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:43 [debug] : Logging in xfinity | 2021-09-12 21:28:45 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:45 [debug] : Saving cookies for next fetch xfinity | 2021-09-12 21:28:45 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet xfinity | 2021-09-12 21:28:46 [debug] : Not logged in xfinity | 2021-09-12 21:28:46 [debug] : Loading (https://customer.xfinity.com) xfinity | 2021-09-12 21:28:48 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:48 [debug] : Logging in xfinity | 2021-09-12 21:28:50 [debug] : Page Title: Sign in to Xfinity xfinity | 2021-09-12 21:28:50 [debug] : Saving cookies for next fetch xfinity | 2021-09-12 21:28:50 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet xfinity | 2021-09-12 21:28:51 [error] : Unable to login xfinity | 2021-09-12 21:28:51 [info] : Next update in 60 minutes @ 10:28:31 PM

zachowj commented 3 years ago

I have seen it hit and miss a lot recently too.

Based on your logs it actually is not completing the log-in sequence. It saves cookies whether it logs in or not. This means nothing is probably wrong on your end.

What I have seen in recent days is even if the correct username and password are used Xfinity is just returning the browser to the login page with the error of "Your username or password is incorrect." But if you try again a couple of hours later without changing anything it works a couple of times then fails again.

I just need to find some time to look deeper.

zachowj commented 3 years ago

Try the latest release and see if that works for you.

janssenjones commented 3 years ago

I pulled latest image, but still got error. Seems to be a new line in the debug logging showing "Login redirects: 3", but otherwise appears to be same results. I'm not positive, but I think it did do a password reset in the last 24 hours. I think my suffix was at 7 yesterday morning when I was troubleshooting, but this morning is at 8. I just logged in manually via MS Edge with the latest pwsuffix, and was able to get in. I have no idea if it's related, but after manual login, it always redirects me to the URL https://customer.xfinity.com/?beta=1 , which seems to be a page where it's trying to get you to sign up for xfinity rewards.

xfinity    | 2021-09-14 07:11:59 [verbose] : Fetching Data
xfinity    | 2021-09-14 07:11:59 [debug] : Loading (https://customer.xfinity.com)
xfinity    | 2021-09-14 07:12:07 [debug] : Login redirects: 3
xfinity    | 2021-09-14 07:12:07 [debug] : Logging in
xfinity    | 2021-09-14 07:12:11 [debug] : Page Title: Sign in to Xfinity
xfinity    | 2021-09-14 07:12:11 [debug] : Saving cookies for next fetch
xfinity    | 2021-09-14 07:12:11 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet
xfinity    | 2021-09-14 07:12:12 [debug] : Not logged in
xfinity    | 2021-09-14 07:12:12 [debug] : Loading (https://customer.xfinity.com)
xfinity    | 2021-09-14 07:12:15 [debug] : Login redirects: 3
xfinity    | 2021-09-14 07:12:15 [debug] : Logging in
xfinity    | 2021-09-14 07:12:17 [debug] : Page Title: Sign in to Xfinity
xfinity    | 2021-09-14 07:12:17 [debug] : Saving cookies for next fetch
xfinity    | 2021-09-14 07:12:17 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet
xfinity    | 2021-09-14 07:12:18 [debug] : Not logged in
xfinity    | 2021-09-14 07:12:18 [debug] : Loading (https://customer.xfinity.com)
xfinity    | 2021-09-14 07:12:20 [debug] : Login redirects: 3
xfinity    | 2021-09-14 07:12:20 [debug] : Logging in
xfinity    | 2021-09-14 07:12:22 [debug] : Page Title: Sign in to Xfinity
xfinity    | 2021-09-14 07:12:22 [debug] : Saving cookies for next fetch
xfinity    | 2021-09-14 07:12:22 [debug] : Loading Usage https://customer.xfinity.com/apis/csp/account/me/services/internet/usage?filter=internet
xfinity    | 2021-09-14 07:12:23 [error] : Unable to login
janssenjones commented 3 years ago

I just wanted to close the loop on this one. I did some more debugging, and for some reason, the was a problem with my pwsuffix reading properly. I went ahead and tried removing the pwsuffix and just putting the last character in my password, and then everything started working, so the problem must've been on my end. I may have manually created the pwsuffix at one point while testing, which may have broken it at that time. I'll go ahead and close this issue. Thanks again for all your work on this project.

janssenjones commented 3 years ago

Specifically, I did find the root cause, which was that there was a line feed or carriage return in my pwsuffix file. I opened it up in and editor and removed it so that it was just the integer without a space or return, and the file works again.