knuckleheadsmiff / homebridge-garagedoor-ryobi

Homebridge plugin for Ryobi GDO (Garage Door Opener)
4 stars 4 forks source link

Name and password cannot contain special URL characters-need to properly escape encode them #7

Closed s1rc closed 4 years ago

s1rc commented 4 years ago

Testing out this plugin however I'm getting an error with valid Ryobi GDO credentials. I verified they work in the GDO app.

[New Garage Door] Error getDeviceID - Message: Error: Unauthorized -- check your ryobi username/password

knuckleheadsmiff commented 4 years ago

That error is coming from ryobi. Is it all the time or just every once in a while? I’m not seeing this (and the few other users have not reported this.) Also a log file might be helpful.

Could you pull branch 0.2.4? It’s possible that some fixes that I was asked to take broke this. If that fixes things then I might rollback those changes, that code was being smarter with cookies to minimize the number of logins that the code was doing.

s1rc commented 4 years ago

It's all the time.

I installed 0.2.4444 and now the error in the log is:

[4/1/2020, 4:03:55 PM] [Garage Door New] Error getDeviceID 1 - retrieving ryobi GDO getDeviceID
[4/1/2020, 4:03:55 PM] [Garage Door New] Error getDeviceID - Message: TypeError: Cannot read property '0' of undefined

I do have the Garagedoor-Command plugin working, I used the same blog post a while ago to get all the web socket data. I wanted to try out your plugin in case something happens on my GDO account, I don't want to have to go through that process again.

knuckleheadsmiff commented 4 years ago

That’s really is the same error, newer code put out a better message by looking for a specific error code for authorization. It really does seem like the name password is wrong? You’ve double checked the json file (I’m sure you have)? If you add “debug_sensitive: true” we can see more info that may help.

s1rc commented 4 years ago

I think I found the issue. I had a password that was autogenerated with symbols, and I'm guessing they weren't being escaped so the password being sent to GDP was actually incorrect.

I changed my password to multiple random word based with hyphen separation and now it appears to work.

knuckleheadsmiff commented 4 years ago

Thanks! That is a valid bug. I’m not escaping (url encoding) name/passwords in one or two places. I’ll fix it when I get the chance but it may not be soon! (The code I initially based it on also did not escape...I should have know better but it was working for me. 😉)

s1rc commented 4 years ago

Run into similar issues myself before, happy to help!

Side note the plugin seems to be more responsive than the GarageDoor-Command plugin and mimicking the GDO web socket commands.

knuckleheadsmiff commented 4 years ago

OK I'm little confused. The rolled back version you installed did indeed have the error described. But the latest version @andyedinborough checked it uses the NPM "request" module and the parameters should be properly encoded if you installed the latest from GitHub directly (the one in the NPM reposityipry may still point to the old version...as I did not update it.)

But his code sort of has a technical error that should not cause an issue he has an unnecessary "encodeURI" on the request/post calls. I'm going to ask @andyedinborough to look into this.

knuckleheadsmiff commented 4 years ago

OK, I updated the NPM Repository version number and published to the NPM repository. Hopefully this should fix the issue. Im closing for now. I really have not worked on this for a long time and maintenance is very minimal.