bryan-bartow / homebridge-alarm.com

Alarm.com plugin for Homebridge
ISC License
43 stars 11 forks source link

Share `sessionUrl` across comands #13

Closed yungsters closed 8 years ago

yungsters commented 8 years ago

In order to share the sessionUrl between requests, we need every WrapAPI endpoint to support an error output scenario when the following elements are detected:

<div id="ctl00_ContentPlaceHolder1_ErrorControl1">
    <font color="#FF0000">Sorry, your session has expired. Please login again.<br></font><br>
</div>

When these elements (and text) are detected, the page actually already has a new sessionUrl. So the WrapAPI endpoints should return the new sessionUrl so we can immediately jump right back into logging in without making yet another initlogin request.

Go to this URL to see what the redirected page looks like with an expired session: https://www.alarm.com/pda/(S(bogus))/main.aspx

I would do this myself, but I'm not very familiar with WrapAPI and whether or not I can publish new versions to the alarmdotcom endpoints.

bryanbartow commented 8 years ago

I'll try and knock this out tomorrow. If not, then for sure over the weekend.

bryanbartow commented 8 years ago

06a2147 uses new endpoints that support a session expired output scenario whose data object contains a sessionUrl property. @yungsters Let me know if that's not what you wanted.