-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
AssertionError: Failed to authenticate garmin user. #109
Comments
Another trace from @grizzls
|
I am able to reproduce locally and I have confirmed the authentication error is appearing on both V1 and V2, which leads me to conclude this is not related to any code change, but rather Garmin has changed some of their authentication rules. This will likely need to be resolved in the garmin-uploader project. V1 stack trace:
|
@philosowaffle I concur (through specific garmin-uploader testing) that the likely culprit is Garmin changing something on their side. |
Plus 1. Same issue here. |
Plot thickens. If I try to manually import the TCX file from Peloton there is done of data not imported. The work type is wrong (walking show running, strength show other). So the import definitely seems to have changed. I wonder if a FIT file would be different. Is there a way to generate a FIT file instead of TCX? |
@kenlpeters I've confirmed your findings on my side as well. I'm trying to find if Garmin has published any changes to the API or TCX files, but I'm not yet familiar with where to look. I am a sw developer, but this is my first time diving into Garmin and it's API's, etc. The red boxes show the same activity from 2 different days (and 2 different import days). The top one does not pick up the title correctly. The green boxes show similar activities from different import days, and both the "type" and "title" are not imported correctly. |
Same here. Software developer and I am digging in to see if I can find what Garmin has done. My only course of action is to FIT files but I do not know how to generate them sintead of TCX using the peloton-to-Garmin software
…On May 18, 2021, 8:21 AM -0400, johnmaconline ***@***.***>, wrote:
@kenlpeters I've confirmed your findings on my side as well.
I'm trying to find if Garmin has published any changes to the API or TCX files, but I'm not yet familiar with where to look. I am a sw developer, but this is my first time diving into Garmin and it's API's, etc.
The red boxes show the same activity from 2 different days (and 2 different import days). The top one does not pick up the title correctly.
The green boxes show similar activities from different import days, and both the "type" and "title" are not imported correctly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@kenlpeters The v2 working branch of @philosowaffle's project here creates and uses FIT files. I've not yet tried it, but maybe you do that test. Further testing/observation reveals a confirmation that TCX file created from the Peloton input has not changed. Therefore, this is further confirmation that the issue is on the Garmin side. |
John,
I am not using V2 so I guess that means I can not generate FIT files?
…On May 18, 2021, 8:47 AM -0400, johnmaconline ***@***.***>, wrote:
@kenlpeters The v2 working branch of @philosowaffle's project here creates and uses FIT files. I've not yet tried it, but maybe you do that test.
Further testing/observation reveals a confirmation that TCX file created from the Peloton input has not changed. Therefore, this is further confirmation that the issue is on the Garmin side.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@kenlpeters @johnmaconline thank you for taking time to look into this further. Let me give you a bit more info before you get stuck going to far down the wrong rabbit hole :)
So, how has title, upload, and activity type been working so far? The answer is we use a 3rd party library garmin-uploader maintained by another great dev here on github, @La0. Some notes on this project:
So, next step is really we just need to create an issue on the |
Can I install V2 in a different directory than V1. If so how. I can not seem to install it.
Do FIT files import the type, etc, when uploaded manually?
…On May 18, 2021, 9:06 AM -0400, philosowaffle ***@***.***>, wrote:
@kenlpeters @johnmaconline thank you for taking time to look into this further. Let me give you a bit more info before you get stuck going to far down the wrong rabbit hole :)
1. Version 1 only supports TCX files. Version 2 does both FIT and TCX and can be found here
2. Whenever you manually upload a TCX file to Garmin, for some reason, Garmin has never honored the Title nor Activity Type found in the file. I don't know why, but its always been this way for P2G.
So, how has title, upload, and activity type been working so far? The answer is we use a 3rd party library garmin-uploader maintained by another great dev here on github. Some notes on this project:
1. Garmin does not publicly expose any documentation about their API. In fact they lock it behind a paywall and are very picky about who they allow access to it.
2. The garmin-uploader project dev has reversed engineered a couple key API endpoints using the browser and wrapped that logic into the garmin-uploader python library. P2G uses this library for all uploading capabilities.
3. In addition to providing the upload feature, this API also allows us to set the Activity Title and Activity Type, which is why they appear correctly in Garmin Connect when uploaded automatically.
4. The garmin-uploader project has good unit tests that can be used to help debug the issue.
So, next step is really we just need to create an issue on the garmin-uploader repo.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Guide for getting up and running on V2: https://github.com/philosowaffle/peloton-to-garmin/wiki/Migrating-from-v1-to-v2 Both V1 and V2 can be installed in different directories and run independently, they do not interfere with each other. Other than they will both try to upload the same stuff to Garmin which could cause duplicates. I'm still trying to improve the docs so feedback appreciated over in the Discussion forum.
Just did a quick test and appears the answer is yes. |
Big problem for me. I am running a Linux server. It appears V2 doe snot work on Linux?
…On May 18, 2021, 9:20 AM -0400, philosowaffle ***@***.***>, wrote:
Guide for getting up and running on V2: https://github.com/philosowaffle/peloton-to-garmin/wiki/Migrating-from-v1-to-v2
Link to all V2 Documentation: https://github.com/philosowaffle/peloton-to-garmin/wiki/Peloton-To-Garmin---v2
I'm still trying to improve the docs so feedback appreciated over in the Discussion forum.
> Do FIT files import the type, etc, when uploaded manually?
Just did a quick test and appears the answer is yes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Docker or building from Source would work on Linux. |
Issued created on garmin-uploader: La0/garmin-uploader#28 |
Working on install V2. Question - do FIT files count towards challenges? |
They should. While I don't have support yet for the custom device code that was added to V1, I do have a default device configured that seems to be working for Badges, and I would assume Challenges as well. |
So when I try ot run in Lunix I get this : "Call Failed with status 401 (Unauthorized) https://api.onepeloton.com/auth/login. I double checked my configuration.local.json and my username and password is correct. I fixed this by making sure the config file was in the proper folder :) |
This sounds like a separate issue from the authentication issue we're all seeing though. You can at least get in, and then you're hitting some processing problems. Maybe split that to another issue? |
Good idea - I deleted them from this thread and opened a new issue. |
Update: The dev from garmin-uploader has identified the issue, but unfortunately Garmin has really stepped up their auth game. Finding if there is a fix or workaround will take some time. For the time being, you will need to adjust your workflows to manually upload to Garmin. |
I will not make a new release until we are sure of the fix. In the meantime, how you test the fix depends on how you are running the code. If you're running docker, pull the If you're running from source, i.e. you downloaded the code to your machine and run
If you are using the windows exe, you'll have to wait a bit longer till we have verified the fix and I make a new release. |
@philosowaffle ok I am using the the Windows exe so I'll sit back and wait for the final update. Thanks! |
I'm using source method on Ubuntu and I keep getting failed to auth using cloudscraper.zip. 2021-05-29 15:01:05,440 [CRITICAL] Login Failure: Authentification failed. |
I get an auth success when uploading exactly 1 activity, an auth failure when uploading > 1 activities. This is with version 1.2, running from source on Windows.
I reproduced this 5 times in a row, so do not believe this is transient. Further, it can be reproduced by starting with uploading 1 activity, and then incrementing the number of activities to upload by 1 each time, so that the previously uploaded activity is skipped, resulting in 1 actual upload (which succeeds, even though it is an older activity). |
Maybe unrelated, but I am using the cloud scraper version with version 1 of P2G. I usually perform the upload using a URL call to a Node JS server which calls the python command and returns the log. This worked great, but the cloud scraper version does not work. If I run the command using SSH is works perfectly. Just strange that calling the command through the node is server fails (no log info) but works through SSH. I will play with a little more and see what I can do. |
Scratch the last comment. I have TSR of an older version running with PM2. Once I killed PM2 and restarted the server ... boom. We server back working. IOS shortcuts works. I am back in business. |
For those of you waiting on a windows exe (@jmnieves) V1 & V2 windows exe's have been updated to include the crowdscraper fix. V1 - https://github.com/philosowaffle/peloton-to-garmin/tree/master/dist Please leave your reaction: |
Downloaded V1 of exe this morning - updated config and ran.
May be missing something.. is 5a. |
I noticed in your log there is this nested error:
And my theory is that it does not like the space in the folder name. Sometimes code has trouble handling this scenario. My hunch is the new cloudscraper library that has been pulled in, may have trouble handling spaces in the file path. @LindsFisch just to experiment, can you rename this folder:
to:
And give it another go? |
@philosowaffle - renamed to
I see there is 1 more down-vote on the windows exe announcement. Curious if we're having similar issues |
Thanks for trying that out. I tested the V2 exe, but have not tested the V1 exe yet (just assumed it would work), maybe I messed something up while creating the V1 exe. I'll test out the V1 exe after work today and see if I can reproduce the error. |
@LindsFisch I am able to reproduce the V1 windows exe issue and will need to investigate further. It seems for some reason the new cloudscraper library does not like being packaged up. |
For people running V2 (docker or source): I have observed on my local install that the cloudscraper fix does not work 100% of the time, it will randomly fail to authenticate. Previously, if you had polling enabled and P2G failed to authenticate with Garmin it would kill the job immediately. I have pushed a small update that changes this behavior. Instead of killing the job, it will now log an error and sleep till the next sync interval at which point it will try to upload again. You can still choose to manually upload your workouts (no need to worry about duplicates), but now you don't have to worry about the sync job dying on you and having to restart it. It will keep running, keep converting workouts, and keep trying to upload to Garmin. And if you happen to be one of the nerds using the Prometheus metrics, there is a new Health metric that will report as UnHealthy when the Garmin upload fails. Regarding windows exe issue: I have not made any progress here yet. |
I think it might be worth setting the default to write out the fit file in the config file until it's higher reliability for uploads too. |
For anyone still experiencing authentication issues I have just added a new experimental feature you can try out #131 To test this out you will need to:
If UploadStrategy 2 is working for you leave a 👍 else leave a 👎 on this comment. |
I will test once you get atleast one successful run with docker since that's my method, strange the code and request would look different |
@dkmcgowan docker is my primary method as well. But am definitely stumped right now on what could possibly be different between the containerized api request vs. non-containerized api request. |
Docker has a different network stack and it gets NAT out the primary interface, not sure if that changes or adds anything to the request, assume you inspected raw request? See if you change network type from bridge to macvlan and then the container would be on the adapter, see if it changes at all |
Also maybe try to switch from bridge to host before going down macvlan method, then something like Wireshark can maybe tell you what's changing in the request |
So far I have tried host mode and also tried running the container behind a vpn network. Still gets flagged by cloudflare. I've checked the headers and cookies on the request and they appear identical between a local run and a container run. Confirmed that the cloudflare cookies from the initial request are getting persisted onto the second request. Its the second request that fails with 403. But so far I have only been inspecting traffic as logged by my tracing inside the container, I suppose next step is to use something like wire shark to see if the request is changing at all as it leaves the container. Something is definitely unique about these requests otherwise cloudflare would not be able to differentiate them. My public IP address is not changing, and I'm using the same UserAgent in all cases. |
@dkmcgowan the Docker image is now working. I had to switch from an Alpine based image to Debian and it started working. I suppose Alpine may have been missing some dependency that caused the HTTP requests to be handled slightly differently. |
Awesome, updating now |
I think we have this fixed for the majority of people. If you haven't updated yet, you'll want to get version 2.0.3 that was just released. With this version you'll be able to configure whichever of the 3 Garmin.UploadStrategy's works for you. |
Just started getting this once I pulled the latest:
INFO:peloton-to-garmin:Uploading activities to Garmin...
2021-05-17 10:58:30,399 [CRITICAL] Login Failure: Authentification failed.
CRITICAL:garmin_uploader:Login Failure: Authentification failed.
INFO:peloton-to-garmin:Failed to upload to Garmin. With error: Failed to authenticate garmin user.
Press the key to quit...
Traceback (most recent call last):
File "/Users/johnmacdonald/code/other/peloton-to-garmin/peloton-to-garmin.py", line 246, in
PelotonToGarmin.run(config)
File "/Users/johnmacdonald/code/other/peloton-to-garmin/peloton-to-garmin.py", line 224, in run
raise e
File "/Users/johnmacdonald/code/other/peloton-to-garmin/peloton-to-garmin.py", line 219, in run
garminUploader.uploadToGarmin(garminUploadHistoryTable)
File "/Users/johnmacdonald/code/other/peloton-to-garmin/lib/garminClient.py", line 29, in uploadToGarmin
assert self.user.authenticate(), "Failed to authenticate garmin user."
AssertionError: Failed to authenticate garmin user.
The text was updated successfully, but these errors were encountered: