fabbr / MMM-Ecobee

Module for Magic Mirror that supports ecobee Thermostat
MIT License
5 stars 2 forks source link

MagicMirrorPinApp requests new tokens and re-authorizes too frequently #1

Open emmettu opened 5 years ago

emmettu commented 5 years ago

Hi,

I'm a backend developer at ecobee and I've noticed the MagicMirrorPin app requests new tokens far too frequently. Recently a single instance of this app made almost 600k token requests and almost 40k authorization requests in a single day.

Access tokens are valid for one hour so you should only need to refresh them every ~45 minutes, refresh tokens are valid for one year and each time you refresh your tokens you are given a new refresh token, so there is no need to make continuous calls to the /authorize endpoint.

The app should be updated so it does not make excessive API calls.

PaulTimmins commented 5 years ago

(as a user) i agree. What's worse is that it doesn't store the tokens correctly so it requires re-authorization if you reboot your magic mirror.

fabbr commented 5 years ago

I have been too busy with work to fix this. It will get done, someday.

The project is open source, if some programmer wants to fix it. Do it a pull and merge request and I will promptly merge it. I have already done the heavy lifting :)

On Jul 30, 2019, at 9:49 PM, Paul Timmins notifications@github.com wrote:

(as a user) i agree. What's worse is that it doesn't store the tokens correctly so it requires re-authorization if you reboot your magic mirror.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fabbr/MMM-Ecobee/issues/1?email_source=notifications&email_token=AB4UAVSZI3UGDT3YDGTJ7S3QCDVUPA5CNFSM4IE6FPLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3FZ2QY#issuecomment-516660547, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4UAVQHDLQXE7DB6NJHHVTQCDVUPANCNFSM4IE6FPLA.

PaulTimmins commented 5 years ago

I've generated my own API key for the test, since they smoked the one this app is in. (In fact, it looks like my house's IP was blocked from api.ecobee.com breaking my thermostat because I was running this plugin without it being signed in after my son bumped the power. I had to switch IPs to test my code.

So far I found the issue where the application wasn't writing the authorization code once rec'd, so it was requiring a reauthorization every reboot.

PaulTimmins commented 5 years ago

@emmettu can you verify the hit rate for 208.83.66.134 is reasonable now? If not shoot me an email at paul@timmins.net or text me at 248-379-7826 and I'll kill it (please don't block my thermostat lol). I have it remembering the pin correctly so now hopefully that takes the load down some.

fabbr commented 5 years ago

Hey Paul, if you fix the excessive request, please make a merge request so we can update the plugin

On Tue, Jul 30, 2019 at 10:44 PM Paul Timmins notifications@github.com wrote:

@emmettu https://github.com/emmettu can you verify the hit rate for 208.83.66.134 is reasonable now? If not shoot me an email at paul@timmins.net or text me at 248-379-7826 and I'll kill it (please don't block my thermostat lol). I have it remembering the pin correctly so now hopefully that takes the load down some.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fabbr/MMM-Ecobee/issues/1?email_source=notifications&email_token=AB4UAVWAVOHPJMSPDCFHY4DQCD4CJA5CNFSM4IE6FPLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3F4PAI#issuecomment-516671361, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4UAVSIUIJ5GNJPZM3LCMLQCD4CJANCNFSM4IE6FPLA .

citizendevpi commented 4 years ago

was this ever solved, they also blocked my routers IP due to to frequent requests. I would like to use this module

fabbr commented 4 years ago

I haven’t had time to work on this and haven’t received any pull request so, no. Not yet.

Sent from my iPhone

On Nov 19, 2019, at 10:23 PM, ed arellano notifications@github.com wrote:

 was this ever solved, they also blocked my routers IP due to to frequent requests. I would like to use this module

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

PaulTimmins commented 4 years ago

Yes, and you merged my pull request to fix it. Lol.

parnic commented 3 years ago

I'm maintaining a fork that fixes a number of additional too-frequent re-auth attempts if anyone would like to try it out.

https://github.com/parnic/MMM-Ecobee