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

[Help] Garmin Uploader failed to authenticate with Garmin. Auth appeared successful but failed to get the OAuth1 token #716

Open
cfm3 opened this issue Jan 15, 2025 · 1 comment

Comments

@cfm3
Copy link

cfm3 commented Jan 15, 2025

Consider checking out the discussion forum to get help from the community. Or fill out this template to get help here.

Problem
I recently started using peloton-to-garmin to sync my workouts and everything was working fine initially. I went to sync 2 workouts last night and was receiving Unauthorized errors from garmin. I have not changed anything so I am assuming something is wrong or changed with the Garmin API

Logs if applicable
You can set your config to "Debug" to get more detailed logs.

dotnet run --project ./src/ConsoleClient/ConsoleClient.csproj
[19:11:21 INF] *********************************************
[19:11:21 INF] P2G Version: p2g_console 4.4.0
[19:11:21 INF] Operating System: Unix
[19:11:21 INF] OS Version: Unix 14.1.2
[19:11:21 INF] DotNet Runtime: 7.0.20
[19:11:21 INF] Docker Deployment: False
[19:11:21 INF] Config path: /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/ConsoleClient/configuration.local.json
[19:11:21 INF] *********************************************
[19:11:21 INF] *********************************************
[19:11:21 INF] *********************************************
[19:11:22 INF] Found 2 completed workouts.
[19:11:24 INF] Found 2 workouts remaining after filtering ExcludedWorkoutTypes.
[19:11:24 INF] Converting workouts...
[19:11:24 INF] [Fit] Backed up file /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/ConsoleClient/output/fit/d3325f83ac4c4ef2806726347984b9b8_45_min_Power_Zone_Rock_Ride_with_Denis_Morton.fit
[19:11:24 INF] [Fit] Backed up file /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/ConsoleClient/output/fit/a1890eb50d144d12a4e74d4b9abb20e9_45_min_Power_Zone_Endurance_80s_Ride_with_Denis_Morton.fit
[19:11:24 INF] Uploading workouts to Garmin...
[19:11:26 INF] HTTP Request: GET - https://connectapi.garmin.com/oauth-service/oauth/preauthorized?ticket=ST-2117101-stxpbvncU1KtYYQqdUHp-cas&login-url=https://sso.garmin.com/sso/embed&accepts-mfa-tokens=true - User-Agent: GCM-iOS-5.7.2.1
Authorization: OAuth oauth_consumer_key="fc3e99d2-118c-44b8-8ae3-03370dde24c0",oauth_nonce="8hqp1v58iuaieker",oauth_signature="sT%2FbdRhK9druJag1hnIjgZqpJ%2FU%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1736554285",oauth_version="1.0"
Accept-Encoding: gzip, deflate
 - 
[19:11:26 INF] HTTP Response: Unauthorized - GET - https://connectapi.garmin.com/oauth-service/oauth/preauthorized?ticket=ST-2117101-stxpbvncU1KtYYQqdUHp-cas&login-url=https://sso.garmin.com/sso/embed&accepts-mfa-tokens=true - Date: Wed, 15 Jan 2025 20:14:07 GMT
Transfer-Encoding: chunked
Connection: keep-alive
WWW-Authenticate: OAuth realm="connect.garmin.com"
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=1GVbcrRkB%2B4VMIpYGxhs2KFi4Ux%2FpvIvIbM%2FnkXqY%2F49LlX9Knqn4cygPDvg7GrlPQyEjzxsOaIiJpuTHsPJUFTxvqtgjC2lk%2F%2F67ULKU3ZAQVKf%2Bj%2FyLtJJlFZqvfcfu173jye%2BudbPKqJEf2oudegESw%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
Set-Cookie: _cfuvid=0_Rg6q.Z4tE7BCLHz9Z8fhUL1bY8OJtTGPZgL.himu8-1736972047832-0.0.1.1-604800000; path=/; domain=.connectapi.garmin.com; HttpOnly; Secure; SameSite=None
Server: cloudflare
CF-RAY: 902887c29bb79033-BOS
Alt-Svc: h3=":443"; ma=86400
 - <!doctype html><html lang="en"><head><title>HTTP Status 401 – Unauthorized</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 – Unauthorized</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Expired timestamp.</p><p><b>Description</b> The request has not been applied to the target resource because it lacks valid authentication credentials for that resource.</p><hr class="line" /><h3>Garmin Connect API Server</h3></body></html>
[19:11:26 ERR] Garmin Uploader failed to authenticate with Garmin. Auth appeared successful but failed to get the OAuth1 token.
Garmin.Auth.GarminAuthenticationError: Auth appeared successful but failed to get the OAuth1 token.
 ---> Flurl.Http.FlurlHttpException: Call failed with status code 401 (Unauthorized): GET https://connectapi.garmin.com/oauth-service/oauth/preauthorized?ticket=ST-2117101-stxpbvncU1KtYYQqdUHp-cas&login-url=https://sso.garmin.com/sso/embed&accepts-mfa-tokens=true
   at Flurl.Http.FlurlClient.HandleExceptionAsync(FlurlCall call, Exception ex, CancellationToken token)
   at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
   at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
   at Flurl.Http.ResponseExtensions.ReceiveString(Task`1 response)
   at Garmin.ApiClient.GetOAuth1TokenAsync(ConsumerCredentials credentials, String ticket) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/ApiClient.cs:line 115
   at Garmin.Auth.GarminAuthenticationService.GetOAuth1Async(String ticket, ConsumerCredentials credentials) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/Auth/GarminAuthenticationService.cs:line 312
   --- End of inner exception stack trace ---
   at Garmin.Auth.GarminAuthenticationService.GetOAuth1Async(String ticket, ConsumerCredentials credentials) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/Auth/GarminAuthenticationService.cs:line 315
   at Garmin.Auth.GarminAuthenticationService.CompleteGarminAuthenticationAsync(String loginResult) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/Auth/GarminAuthenticationService.cs:line 207
   at Garmin.Auth.GarminAuthenticationService.SignInAsync() in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/Auth/GarminAuthenticationService.cs:line 186
   at Garmin.Auth.GarminAuthenticationService.GetGarminAuthenticationAsync() in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/Auth/GarminAuthenticationService.cs:line 87
   at Garmin.GarminUploader.UploadAsync(String[] files, Settings settings) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/GarminUploader.cs:line 84
   at Garmin.GarminUploader.UploadToGarminAsync() in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Garmin/GarminUploader.cs:line 74
   at Sync.SyncService.SyncAsync(IEnumerable`1 workoutIds, ICollection`1 exclude) in /Users/cmorris3/Desktop/Software/peloton-to-garmin/src/Sync/SyncService.cs:line 171
[19:11:26 INF] Done.

Installation (please complete the following information):

  • OS: mac
  • Method: source
  • Version: 4.4.0

Additional context
I do not have MFA enabled for my garmin account and I tried to change my password to see if there was anything funky with that

@philosowaffle
Copy link
Owner

Notes for myself:

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

No branches or pull requests

2 participants