-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
having issues logging in #199
Comments
looks like this URL might have changed to |
ok, I was able to login using the following URL: |
Is there anyway to force this change in hassos (eg; where can I find the integration)? |
changing just the urls don’t do the trick, at least for me. Gives me a415 error as result. {'type': 'https://tools.ietf.org/html/rfc7231#section-6.5.13', 'title': 'Unsupported Media Type', 'status': 415, 'traceId |
Same for me—updating the URL's on the Trying both the URL suggested in this issue ( |
I turned on some of the logging info and found that the login request is returning an error: Here is the detail I see from the debug logger:
Following all this, I get the usual python exception error |
So it looks like there are a couple things going on here that I missed:
|
Think this is the end of the road? Or can it be fixed @benleb ? |
It can definitely be fixed - I'm not sure where benleb is or what he's up to right now though. This stuff is open-source though, so others can suggest changes via PRs. SurePetcare have always taken the line that their API isn't public, so it's going to be challenging to work out which end-point should be used. From what I've seen so far, that's the only stumbling block. The rest can probably be reverse-engineered. |
might just be a matter of trying to hit |
There has to be some sort of DNS redirection to green or blue. Probably something they're doing with Route53. I don't see any other domain that's obvious in the replies though. |
What does this mean? HTTPSConn |
BTW, looks like blue/green isn't necessary anyway. I get a full response from this command (on Windows, hence the caret):
|
sorry guys, will have a look at this at the weekend... but from first look here, its a problem on their side where a workaround has to be built?! About API is expecting application/json requests... the accept header is already set and when also adding content-type I get a 400 bad request :D will dig deeper at the weekend :) |
@flyize I spent about 30 seconds trawling through JS on the surepetcare.io website to see if I could determine which API end-point was used, but the code is massively obfuscated so I gave up on that immediately. I'm sticking with my theory that the end-point without the colours in it is the primary end-point, and some kind of load-balancing will redirect requests to blue and green end-points as required. I also think that the swagger docs on all three end-points aren't necessarily 100%; from my testing earlier on this week, the primary end-point looked like it was the only one that can issue auth tokens. I'm also not ruling out surepetcare taking a buggy/unfinished end-point live. This isn't a below-the-belt blow targeted at surepetcare themselves; we've all pushed stuff to production that may have resulted in bugs revealing themselves. ;) |
probably just a typo, but the (for us) relevant page is https://surehub.io (js is also obfuscated here) |
I've just taken a look at the HTTP traffic through a proxy, and the endpoint to use is For the issue that I've been facing (unable to set Pet location in Home Assistant, see home-assistant/core#105730), here is the request that the application makes to do the same:
So we can see The issue that I have been facing with Home Assistant is that I'm getting back a HTTP 415 response, which indicates an issue with the Here's an example using no
And with the correct
As you can see, it works just fine (even with the assumed old URL). I can work on a little PR for this to get it fixed up if you like? |
@benleb I'm unfamiliar with what the older API looked like, but from what I can see it did not expect a JSON payload before, is that correct? If so, the issue here appears to be that the newer version of the Surepet API speaks JSON, and should be rather trivial to use raw_response: aiohttp.ClientResponse = await session.post(
url=AUTH_RESOURCE, json=authentication_data, headers=self._generate_headers()
) |
ah nice @AlexC - can confirm that works for me too! 🎉 👍 and what the API really expects or expected... we actually never really knew :D We never got in good contact with sure petcare (we think they dont want to due to some reason :/) and just "reverse engineered" the calls from the app and so on... afaik the headers initially were a copy of what the app sent, but that was years ago... and about a MR, sure :) 👍 if nobody does it until the weekend, I will :) 👍 |
ah there already is one :D #201 - from sure petcare itself <3 thanks! but content-type header is missing in that one |
@benleb Yeah, I wasn't aware that the Python lib was not sending a JSON payload, so just setting the header to I did receive a notification/message from the official Surepet application the other day, saying that I must update the application to the latest otherwise it will stop working. That ties into the failures that we're seeing here now, so I can only assume they've made some breaking changes to their API (so that it now only speaks JSON, most likely) The linked PR looks good to me, as the |
I know you have closed this, but I also had to initialise the json object to get it to work (shown below).
|
Just a heads up this still isn't working for me either, I'm still getting a 401:
|
@chrisdrackett - I would double check that your credentials work correctly on the main Sure Petcare app webpage. |
I had the same problem. Delete the integration on HA and reinstall it. After that it should work. But don't forget to update to 2023.12.4 first! |
Getting the following in HASS that I assume is a surepy issue (well, a sure petcare issue really I would guess)
2023-12-10 13:30:26.544 ERROR (MainThread) [surepy.client] 🐾 �[38;2;255;26;102m·�[0m GET app.api.surehub.io/api/me/start: 401 | <ClientResponse(https://app.api.surehub.io/api/me/start) [401 Unauthorized]>
2023-12-10 13:30:28.024 DEBUG (MainThread) [surepy.client] 🐾 �[38;2;0;255;0m·�[0m GET app.api.surehub.io/api/me/start | 6
2023-12-10 13:30:28.025 DEBUG (MainThread) [homeassistant.components.surepetcare] Finished fetching surepetcare data in 1.623 seconds (success: False)
2023-12-10 13:30:28.025 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Sure Petcare' for surepetcare integration could not authenticate: Invalid username/password
The text was updated successfully, but these errors were encountered: