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

GarminConnect.php - an unexpected response code was found: 403 #27

Closed
pygoubet opened this issue Oct 6, 2023 · 10 comments
Closed

GarminConnect.php - an unexpected response code was found: 403 #27

pygoubet opened this issue Oct 6, 2023 · 10 comments

Comments

@pygoubet
Copy link
Contributor

pygoubet commented Oct 6, 2023

Message: "An unexpected response code was found: 403"

In GarminConnect.php line 261:
                                              
  An unexpected response code was found: 403

This issue is already referenced in php-garmin-connnect project as Anyone getting 403 error from Garmin Connect starting today? #61

@Raistlfiren
Copy link
Owner

Thanks @pygoubet, it looks like we will need to use a headless browser or some other means of creating/editing/deleting workouts now based on the code https://github.com/petergardfjall/garminexport/pull/105/files#diff-6093a27e9170fd8a464a72b64b04bca3857c7a77fab45b8dece651661fdfb129

I'll have to look into it soon.

@cl201831
Copy link

cl201831 commented Oct 7, 2023

Cet outil est génial. J'espère que vous arriverez à trouver une solution. Merci.

@Silver-Saucepan
Copy link

For info: I get response code 402 (not 403 as reported above) but I'm guessing it's the same underlying issue

@faina09
Copy link

faina09 commented Dec 20, 2023

May be I fixed this issue setting on line 285 of GarminConnect.php:

$strResponse = $this->objConnector->post( 'https://connect.garmin.com/modern/workouts',

instead of 'https://connect.garmin.com/modern/proxy/workout-service/workout'.

But now I got the error:

[critical] Error thrown while running command "garmin:workout "multi-events-day.csv" -vvv". Message: "Warning: Attempt to read property "workoutId" on null"
[debug] Command "garmin:workout "multi-events-day.csv" -vvv" exited with code "1"

In GarminHelper.php line 69:

[ErrorException]
Warning: Attempt to read property "workoutId" on null

@Raistlfiren
Copy link
Owner

Hi all,

Please test the latest release. I have updated the code base to use the latest authentication method from Garmin. Authentication is a convoluted five-step process with Garmin. It is using Garth's consumer key and secret - https://thegarth.s3.amazonaws.com/oauth_consumer.json

I have not tagged or created a release for this version, yet. I also haven't added anything to handle MFA by Garmin.

Thanks

@pygoubet
Copy link
Contributor Author

Hi @Raistlfiren
Well done! It worked (after a little change).
It would be great if the GARMIN_AUTHENTICATION_FILE could be overridden at run time. Or hardcoded to a subfolder within the workdir /usr/src/garmin-csv-plan. As example public const GARMIN_AUTHENTICATION_FILE = 'tmp/garmin_credentials.json';.
In my case, /usr/src/garmin-csv-plan is not writable, so the credential file cannot be created.

@Raistlfiren
Copy link
Owner

Thanks @pygoubet. I added a variable in the .env file called GARMIN_AUTHENTICATION_FILE_PATH where you can specify the path. :)

@cl201831
Copy link

cl201831 commented Jun 20, 2024

Many THANKS @Raistlfiren for taking the time to resolve this issue. Best regards.
It works very well.

@faina09
Copy link

faina09 commented Jun 21, 2024

great @Raistlfiren now it works fine, thanks!

@pygoubet
Copy link
Contributor Author

Thanks @pygoubet. I added a variable in the .env file called GARMIN_AUTHENTICATION_FILE_PATH where you can specify the path. :)

Very convenient, thanks!

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

5 participants