cyberjunky / python-garminconnect

Python 3 API wrapper for Garmin Connect to get activity statistics
MIT License
908 stars 142 forks source link

Could this package be requesting a Password reset as an unknown side effect? #125

Closed lfcipriani closed 1 year ago

lfcipriani commented 1 year ago

I have an integration using this package in my server, being triggered via cron on specific times, let's say every hour at the minute 22 and 44.

It happened two times already that I'm receiving emails about a request to reset my Garmin connect password that was not requested by me. The emails arrived at the minute 22 and 44 of an hour, which is the only evidence I have that this might be triggered somehow by this package or it's a non expected side effect given the way the API integrtion works.

Problem is that the way Garmin works with password reset is that it logs out from all my devices until I put the temporary password generated by the email and because this happened 2 times already with 2 weeks interval, I had to disable the integration.

Did someone already experienced that?

This is my login function:

def login(email, password):
  try:
      api = Garmin(email, password)
      api.login()
  except (
      GarminConnectConnectionError,
      GarminConnectAuthenticationError,
      GarminConnectTooManyRequestsError,
      requests.exceptions.HTTPError,
  ) as err:
      logger.error("Error occurred during Garmin Connect communication: %s", err)
      return None
  return api
psdupvi commented 1 year ago

I haven't experienced that issue, although I don't call the login function every time. I've used the session.json method illustrated in sample.py, and that seems to work. I probably actually "log in" maybe twice a day?

I have occasionally had to log in again on the website, but never a password reset, and it's never affected the Connect Mobile App

lfcipriani commented 1 year ago

Thanks @psdupvi, you have a good point, maybe I should change my strategy to use the session.json and avoid login in every time. I'll try it.