-
Notifications
You must be signed in to change notification settings - Fork 41
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
Anyone getting 403 error from Garmin Connect starting today? #61
Comments
Same |
Same here. Some days ago it was working... |
I am guessing that Garmin changed the URL. But i don’t know how to figure out what the new URL is (assuming they still support this). |
Are you getting a 403 when trying to login or is it a 403 when performing one of the requests for data? |
Seems like this URL at least produces a blank page: https://connect.garmin.com/modern/proxy/activitylist-service/activities/search/activities I log in using a browser and try to visit this URL and it is just two HTML tags. No error is generated during the log in process that I know of… |
I'm not sure if this is new, but a request to the search endpoint here in the browser, looks like it's passing a bearer token in the request header, which indicates that this search endpoint is now behind some auth mechanism. Will do some more investigation when I've got some time. |
perhaps it should be https://connect.garmin.com/activitylist-service/activities/ ... ? |
Thanks, I just tried that link which produces an error page. Appreciate the suggestion, though. |
I can see that everyone who uses garmin connect in all programming languages faces the same issue. I found very nice options here: but it takes time to test and develop everything. If someone will do the same - let us know, otherwise I will try to sit this weekend and try to change the code. |
here some other issues (and solutions) mostly for python clients: petergardfjall/garminexport#102 |
Thanks for the links anniew. Do you see how to integrate Garth with this PHP project? I’m at a loss. |
Not easily. Essentially there needs to be a rewrite of a large chunk of the authentication workflow of this library to match what Garth is doing in Python. |
I’ll take a look tonight and see what’s what.
…On Mon, 16 Oct 2023 at 15:33, James ***@***.***> wrote:
Not easily. Essentially there needs to be a rewrite of a large chunk of
the authentication workflow of this library to match what Garth is doing in
Python.
—
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADHRHXCQ7VN6C2GZDZ55R3X7VATXAVCNFSM6AAAAAA5IEUKSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRUGYYTINJWGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Chip
Financial Ltd (“Chip”) is registered in England and Wales,
registration number:
#10113174
Our registered office is: Chip Financial
Ltd, Sixth Floor,Fora Montacute Yards, 186 Shoreditch High Street, London,
E1 6HU
Note
that Chip is not a bank, meaning that we do not have
physical branches, issue
debit bank cards nor are you able to access your
Chip money via ATMs. Chip does
not provide financial advice and our
services are only available via the Chip
app.
Chip
is a trading name of
Chip Financial Ltd and is authorised by the Financial
Conduct Authority
under the Payment Services Regulation 2017 for the provision
of payment
services. Firm Reference Number 911255.
|
@DaveWilcock I found this comment pretty useful: petergardfjall/garminexport#104 (comment) I got curl-impersonate to compile and have it loaded into my php install (docs here) and was hopeful it would just work like the comment suggested on their library, but it didn't, same 403 error. I was going to attempt to see what else I might need to adjust in your library but I ran out of time. I don't think it's necessarily feasible for all users to be able to compile and adjust their php configuration, but unsure. For me it would be completely acceptable to require that. The Garth solution definitely appears to be the best long term way as it seems to impersonate the mobile application, but looks like quite a bit of work. |
Hi, I was able to integrate the python solution https://github.com/cyberjunky/python-garminconnect (thank you very much cyberjunky ) with my own PHP program. It is not Garth alone but a very helpful python project which is using Garth. Below step-by-step description of my approach, please keep in mind, that I'm using Linux Debian.
#!/usr/bin/env python3
import sys
import os
import json
from garth.exc import GarthHTTPError
from garminconnect import (
Garmin,
GarminConnectAuthenticationError,
GarminConnectConnectionError,
GarminConnectTooManyRequestsError,
)
userid = sys.argv[1]
password = sys.argv[2]
command = sys.argv[3]
tokenstore = os.getcwd() + '/garmin_tokenstore/' + userid
def init_api(email, password):
try:
# Trying to login to Garmin Connect using token data from '{tokenstore}'
garmin = Garmin()
garmin.login(tokenstore)
except (FileNotFoundError, GarthHTTPError, GarminConnectAuthenticationError):
# Login tokens not present or session is expired, login with your Garmin Connect credentials to generate them
# They will be stored in '{tokenstore}' for future use.
try:
garmin = Garmin(email, password)
garmin.login()
# Save tokens for next login
garmin.garth.dump(tokenstore)
except (FileNotFoundError, GarthHTTPError, GarminConnectAuthenticationError, requests.exceptions.HTTPError) as err:
logger.error(err)
return None
return garmin
api = init_api(userid, password)
if command == 'getActivityList':
count = sys.argv[4]
response = api.get_activities(0,count)
print(json.dumps(response))
elif command == 'getActivity':
activity_id = sys.argv[4]
response = api.get_activity_evaluation(activity_id)
print(json.dumps(response))
elif command == 'getActivityWeather':
activity_id = sys.argv[4]
response = api.get_activity_weather(activity_id)
print(json.dumps(response))
else:
print('invalid command')
$userid = 'YOUR_GARMIN_USER';
$password = 'YOUR_GARMIN_PASS';
$count = 10;
$home = getcwd();
$response_json = shell_exec( "PYTHONPATH=python_packages {$home}/garmin.py $userid $password getActivityList $count" );
echo json_decode($response_json, true); It is a workaround for me, if possible I would like to use back this PHP project and have a pure PHP solution, I hope it helps, |
Anybody with a php solution meanwhile?? Desperately waiting for it...Thanks to everybody who helps to get this working again! |
Not sure this is any help, but I ended up using their API. I signed up as a developer, and got my codes. The app got approved; this part was easy. Trying to learn the API with the paucity of documentation was difficult… but in a nutshell, Garmin will “ping” your web hook when a new activity is uploaded. The ping contains a json that only has a little information, but one item is a special URL for the activity - which includes an activity ID (that does NOT match the activity ID that you are used to) and a token. All of this is a major pain to learn, but over the course of a few days and another php Garmin connector on git hub, I was able to get it to work. Now that it is working, I am glad I chose that route instead of relying on the spoof browser method. I really love that creative people have worked so hard on this project, but as it is written now, it will continue to break whenever Garmin changes their website. |
I had no time and ended up using python-garminconnect by cyberjunky - once the file is in server all the parsing part and the rest project is being done by php as before. |
Can you share which garmin connector on github you used to learn this? I´m still struggeling to get it to work 🙈 |
Christian- i installed this: https://github.com/stoufa06/php-garmin-connect-api It did not work initially, as I had to make a change to one line of code as described here (uriFor vs uri_for): stoufa06/php-garmin-connect-api#12 That will save you a lot of time! Once I got the example working, it gives me a summary of activities. Quite happy with that… but then i used my Garmin API Developer account, and from there I can manage “pings” from the API to my webhooks. All new activities come to my specified URL (by the way, you will have to dig on the Garmin developer page to find your API settings to specify the endpoints). Now that I have done all this work, I am quite happy, and feel like my tools will be more reliable in the future. It’s a 100% PHP solution. |
Thanks for this info Brian. Do you know if the developer access to their
APIs is limited in any way? e.g. by time or API call rate limiting, etc.
…On Fri, 27 Oct 2023 at 12:48, Brian ***@***.***> wrote:
Christian-
i installed this:
https://github.com/stoufa06/php-garmin-connect-api
It did not work initially, as I had to make a change to one line of code
as described here (uriFor vs uri_for):
stoufa06/php-garmin-connect-api#12
<stoufa06/php-garmin-connect-api#12>
That will save you a lot of time!
Once I got the example working, it gives me a summary of activities. Quite
happy with that… but then i used my Garmin API Developer account, and from
there I can manage “pings” from the API to my webhooks. All new activities
come to my specified URL (by the way, you will have to dig on the Garmin
developer page to find your API settings to specify the endpoints).
Now that I have done all this work, I am quite happy, and feel like my
tools will be more reliable in the future. It’s a 100% PHP solution.
—
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADHRHQEJKVJG56G3MG3G4LYBONQDAVCNFSM6AAAAAA5IEUKSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBSG43TQNRTG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Chip
Financial Ltd (“Chip”) is registered in England and Wales,
registration number:
#10113174
Our registered office is: Chip Financial
Ltd, Sixth Floor,Fora Montacute Yards, 186 Shoreditch High Street, London,
E1 6HU
Note
that Chip is not a bank, meaning that we do not have
physical branches, issue
debit bank cards nor are you able to access your
Chip money via ATMs. Chip does
not provide financial advice and our
services are only available via the Chip
app.
Chip
is a trading name of
Chip Financial Ltd and is authorised by the Financial
Conduct Authority
under the Payment Services Regulation 2017 for the provision
of payment
services. Firm Reference Number 911255.
|
Dave - One way is that you can send requests using the https://github.com/stoufa06/php-garmin-connect-api tool. The other way is (once you have an account), for any user who has agreed to share their data, new activities can be "pinged" to a webhook you specify here: https://apis.garmin.com/tools/login (note that you need an approved account to log in here) You manage your app/team here: https://developerportal.garmin.com/ To me, it seems pretty round-about, and definitely not "clean". Having worked with the Strava API, I find it much more intuitive... but this is what we are faced with. I hope this helps others. Also, Dave: Thanks for your work all these years keeping this project working. Really appreciate it. |
@fulmar2 Thank you for the mention
If anyone needs help with garmin api thing i have an upwork account so you can hire me. |
The code has been working for a while, but today started getting a 403 error from Garmin Connect. Anyone else experiencing that?
The text was updated successfully, but these errors were encountered: