Closed chrisstuart-cl closed 3 months ago
I have an old fork of the library but I was able to replicate and fix the issue. I could try to sent a PR this weekend.
What I did is I replaced the auth logic to completely to replicate what homebridge does here. https://github.com/dgreif/ring/blob/main/packages/ring-client-api/rest-client.ts
Specifically, the 2 changes that I made is added the User-Agent header to be android:com.ringapp
and the body of the request to get the session here https://github.com/KoenZomers/RingApi/blob/032bd6f2c633a7989b63a64c398b7bae861f1ad2/Api/Session.cs#L183
For this
$"{{ \"device\": {{ \"metadata\" : {{ \"api_version\" : 11, \"device_model\": \"ring-client-api\" }}, \"hardware_id\" : \"{deviceId}\", \"os\" : \"android\" }}}}"
PR to solve this issue #32
Problem also appears with all Versions of RingSnapshotDownload since March 8th, see here: https://github.com/KoenZomers/RingSnapshotDownload/issues/7
Problem also appears with all Versions of RingSnapshotDownload since March 8th, see here: https://github.com/KoenZomers/RingSnapshotDownload/issues/7
Yes, it seems this library will need the updates too, I am talking to @KoenZomers to get to be coauthor of the libraries. Would anyone be willing to send a PR replicating this changes? @chrisstuart-cl @scholzmichael
Naive question but why does the other project have a duplicate of the API library code, meaning that fixes have to be made in both places? Given that Ring seems to keep breaking their API for consumers, this will be an ongoing problem.
I have merged the fix to the main branch, I'll work on creating a new NuGet today.
Naive question but why does the other project have a duplicate of the API library code, meaning that fixes have to be made in both places? Given that Ring seems to keep breaking their API for consumers, this will be an ongoing problem.
Excellent question! Reason being that I found out that Ring does change its API at times. Since its not a public API which is documented, they do so with breaking changes. In which case the code crashes. Since the Ring API project might be in use by other people for various purposes, I don't know which of the exposed properties they are using. My intention by duplicating the code was that I could easily narrow down the API model to the very basics to limit the chances of any changes to what their APIs spit back breaking the code. As a consequence of that, there's now duplicate code, in favor of lowering chances that it might break.
Good news all! We have a new version https://www.nuget.org/packages/KoenZomers.Ring.Api thanks all for reporting the issue and helping testing the fix.
Hi, it would be nice to get this now into https://github.com/KoenZomers/RingApi here as well...
Describe the bug Message: Class Initialization method KoenZomers.Ring.UnitTest.UnitTest.TestInitialize threw exception. System.Text.Json.JsonReaderException: System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0..
Server is returning 406 Not acceptable from call to https://oauth.ring.com/oauth/token
To Reproduce Run AuthenticateWithRefreshTokenFailTest
Expected behavior Test should pass.
Versions (please complete the following information): Version 0.5.3.0