-
Notifications
You must be signed in to change notification settings - Fork 29
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
Implement re-authentication of expired OAuth (Single ID) tokens #250
Comments
Same for me |
i think at the moment this is the only (and therefore correct) way to re-authenticate. I don't know if there will be another solution in the future. |
This issue is stale because it has been open for 14 days with no activity. |
I'm also checking for an easier way to renew the token... |
This issue is stale because it has been open for 14 days with no activity. |
Currently there is no way to renew an expired token. You have to remove and re-add the mower. I will keep this issue open. As it might be a nice improvement for a future release. |
Thank you Sander, we really appreciate your efforts! |
Thanks @sander1988. I will keep looking at this issue - every once in a while. |
This has been implemented and is available for testing on the dev branch. HA will now show a warning and a reconfigure button when the authentication fails. @Vitani - I had to make the assumption that the Bosch API reports HTTP error code 401 in this case. As the error log/stacktrace is missing in the issue description. Maybe you still have the original error? |
This change requires some new translations (see the EN file in commit 517f97b). I have added them for EN and NL. Can someone provide DE, FR, PL and/or SK? |
I will take care of the DE translations tomorrow. |
@sander1988 I don't have the original logs, sorry |
This comment has been minimized.
This comment has been minimized.
@pbwild - Please open a new issue for your error (and answer the questions in the template). The error doesn't seem to be related to this issue. |
Here is the updated de.json translation file. |
Hi there ! Cheers. |
Thank you @kimzeuner and @urbatecte for the DE and FR translations. I just merged the files on the dev branch. |
Was anyone able to test this new feature due to an expired token? I would like some feedback before merging and releasing it. I faked expired tokens during testing, but I would like to know/see if it works for real. |
I'd be willing to test this (I have a currently-broken install with expired tokens after the upgrade to 5.7.7), but I couldn't figure out how to switch to the |
I think with the new HACS it is no longer possible to load develop branches or beta version through HACS. I think you will have to go to the indego integration on github. There you will find a button with "main" in the upper left corner (next to the box where the files and folders are listed). There you have to choose "develop". Download the files from "custom_components/indego" and copy them to your HA instance (again in the folder "custom_components/indego". After a HA restart it should have the new version. You can download the whole directory as a zip file. |
Thanks @kimzeuner, that did the trick. I was looking for an official way to do it because replacing the files under the hood seemed a bit hacky, but I found none. Anyways, @kimzeuner's method worked, and I'm now on the It should also be noted that I don't get a 401 error, but a 400 error. My logs look like this:
Let me know if you need any additional information. And also thanks for looking into this issue! |
Oh, by the way, the logs above were from 5.7.7. With
|
Are you sure the user-agent is set to a value that's known to have worked before? As normally 400 = Azure WAF blocking the request (which it does for unknown reasons for some user-agents), 401 = OAuth token issue. |
I'm using "Rasi Indego (3.2.0)" as a user agent, and that has worked before. I've changed it to "Rasi2 Indego (3.2.0)", same error. Did you look at the "Token request has failed" error message as well? |
Can you perform a test by changing this line https://github.com/sander1988/Indego/blob/develop/custom_components/indego/__init__.py#L239 to:
Make sure you don't break the indention of the file. This should show the reconfigure button ("opnieuw configureren") for all 4XX errors. I'm wondering if the reconfigure flow can get you out of your current OAuth state. Please share the results. |
Yes, it's working beautifully! The reconfigure flow could fix my current OAuth state. Here are some screenshots of the new "reconfigure" button: And here are my very verbose notes of what I did:
|
@mintar - Thank you for testing and feedback! I will do some more tests and make the change permanent when I'm sure it doesn't break anything. |
Hi @sander1988, |
Hi, |
Ok. Thank you for confirming. |
Version 5.7.8 has been released; containing this new feature. |
When I get the error (in the logs)
Token request for indego failed (invalid_grant): ABC123: The provided grant has expired. Please re-authenticate and try again.
I know I have to re-authenticate, but the only way I can seem to do that is to delete the integration and re-add it; is that the correct way, or am I missing an alternative?The text was updated successfully, but these errors were encountered: