-
Notifications
You must be signed in to change notification settings - Fork 16
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
Netatmo API Security Update - is the node ready? #27
Comments
Netatmo talks about removing "Client Credentials Grant", but I suspect they actually mean "Resource Owner Password Credentials Grant". I assume this plugin uses the latter authentication flow, because the user password must be entered in the node configuration and there is no user-interaction for token exchange. So I guess this plugin will cease to work. |
Is there a chance that the Node will be updated to support the new OAuth2 authorization? |
@ssadams11 This package uses the "grant type method= password", that will be completely removed. |
As none of the contributors climbed in I'm afraid that the Node will be dead after September 30th. Looks like we should build something else. John |
Hi all, I get in touch with the Netatmo Dev Support to request some more informations and details about the changes. There is also another plugin which is having the same situation and facing the same limitations of Node-Red: Here the feedback from the Netatmo Developer Support:
I hope this can help somebody. Thanks JO |
You can issue an access and refresh token from the netatmo developer portal for your application. If the plugin allowed to input those tokens (instead of user credentials), API access would be possible without user interaction. I think the change would be fairly straightforward to implement. |
I agree. But this implies to store the refresh_token somewhere and to refresh it when needed. AFAIK Node Red cannot store it. |
Interesting, where did you find that information? Refreshing access tokens with refresh tokens is a standard oauth2 process. It is also described in the developer documentation: https://dev.netatmo.com/apidocumentation/oauth#refreshing-a-token As long as the 'grant' of the application is not invalidated by the user, refreshing should work indefinitely. |
Yes, you can refresh indefinitely, but this requires you to store the refresh token each time somewhere. |
Thank you, I missed that note in the post of @jostrasser . I can't imagine that rotating refresh tokens every three hours is feasible for any application... Anyway, I guess it would be possible to store the (renewed) refresh token in persistent context, though this would require additional configuration. This won't solve the problem that refresh tokens might expire without using them, for example if the flow is stopped, of course. |
Oh, I just noticed, that the node uses an external lib to access the netatmo api: https://github.com/floetenbaer/netatmo |
Hi @altery About the information "Netatmo possibly changing this method in the future": |
Hi all,
Don´t know if this is solving the "saving issue of keys in Node-Red" |
No. If you read the message from Netatmo Support: "you will simply be able to refresh it and save the new ones after refresh" |
I have taken a look at the code, the node uses the Netatmo.js packed which uses:
source https://github.com/floetenbaer/netatmo/blob/481f0652c60d39ea74c29a0e680bded658a98516/netatmo.js#L98 as Post Parameter, so I think this must change to the new grant_type and exchange the username/password with the manuell generated token in the dev.netatmo.com config from the app. Ok I have try this - not so easy at all :-( seams to do much more. :-( |
OK, another test. I have done a request like in the FAQ - I get a CODE after confirm the access. With this code I can do one request like this:
now it's only possible to make requests with token/refresh token - but the netatmo.js is using the same auth-request at every request - so the code at the next call is not valid anymore. So the netatmo.js must do this on other way - and use only token/refreshtoken instant of a full auth-request. So netatmo.js has to improved for this before this node can work again. :-( |
the |
Not only the refresh also the normal token - but when you stop the requests for more then 3h you need a new grant-code also. Problem in this node is, every input-trigger creates a new netatmo.js an call AUTH and not reuse the toke/refreshtoken. |
Absolutely NOT! |
In my tests I can use the CODE from the grant-request only one time. The token and refresh-token are reusable. We are talking about the same "code"? |
The refresh_token returned from you refresh request. You should have a look
at Netatmo developer's documentation.
- Sent from my mobile phone. Sorry for typos -
Il Sab 3 Set 2022, 17:41 Alexander Palm ***@***.***> ha
scritto:
… In my tests I can use the CODE from the grant-request only one time. The
token and refresh-token are reusable. We are talking about the same "code"?
And is anyone on the way to update this node to work after end of this
month?
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBCQ3RB6WAQGXHKX7C3T43V4NWQXANCNFSM55SE5Y2Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@fmarzocca yes, the refresh_token can reuse but I talk about the CODE from the Documentation your revert:
This works only one time. |
Yes. You don't need to call it more.
- Sent from my mobile phone. Sorry for typos -
Il Sab 3 Set 2022, 17:55 Alexander Palm ***@***.***> ha
scritto:
… @fmarzocca <https://github.com/fmarzocca> yes, the refresh_token can
reuse but I talk about the CODE from the Documentation your revert:
Step 3 - The user is redirected to your application
The user is now redirected to the callback URL defined in your application
settings or to the redirect_uri provided in the request. If they authorized
the application they will be redirected with additional parameters :
[YOUR_REDIRECT_URI]?state=[YOUR_STATE_VALUE]
*code=[NETATMO_GENERATED_CODE]*
This works only one time.
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBCQ3QWT2IN53EZ6ZLI6W3V4NYIPANCNFSM55SE5Y2Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@AleksCee with all due respect, your contributions to this thread are not very constructive for resolving this issue. Please familiarize yourself with the concepts in OAuth2 (e.g. https://oauth.net/2/grant-types/authorization-code/ ). I think the problem domain is clear, and as long as netatmo does not expire refresh-tokens, we're all set. |
I am also a bit worried that the plugin will stop working shortly. No cotributor has joined the discussion yet. It would be good to get a feedback when this problem will be addressed. Otherwise, many users will have to think of an alternative quickly. In my case there are many dependencies to the entire home automation. |
@altery sorry for this - but I had see the node from this guy https://github.com/csuermann/node-red-contrib-virtual-smart-home and he has implemented the whole oauth2 process in node-red - with grant and code requests. So this was about my testing and documentation. But I understand and will be quit for now. Hope someone fix this helpful node. |
No worries, just don't want to use this thread to discuss the oauth2.0 standard ;) Anyway, I quickly forked and patched both https://github.com/floetenbaer/netatmo and https://github.com/ssadams11/node-red-contrib-netatmo to see how that goes. Good news is, the change is quite straight forward and seems to work so far: The bad news is, the token that you can generate from the netatmo developer portal (https://dev.netatmo.com/apps/) is an access token. The portal does not display the refresh token. This makes it cumbersome for users to get a refresh token. One way to obtain a refresh token without implementing a custom backend is by using postman, which supports oauth2.0 auth flows (by implementing a custom protocol handler): If i got time, i'll push the fork to github, so that at least we got a (dirty) option in case netatmo really disables password grant in october. I also placed an inquiry to netatmo developer support, if they could postpone the timeline for this change. |
For this problem (Token) I have make a Flow in 2 Steps - first generate the URL for the Auth-Request and show it in debug-output. After copy this URL in the Browser an send it, the second has a http-in which received the code and post it to the "toke-get-request". Only the client_id and client_secret must set in the Injection node. Should I post the export or is the Postman way more easy? Here it is, if anyone like to use this direct in nodered without other tools.
|
Your flow is way more easy than Postman, and much more consistent. You could save the refresh_token in a global context. |
Hi @altery Do you have any chance to publish your patched version? Or do you think https://github.com/ssadams11/node-red-contrib-netatmo will be patched until Netatmo is disabling the old auth method? October is near... :/ Thanks! |
Unfortunately, I didn't get around to continue working on it. I could publish a fork of the netatmo library, but the forked library and additional changes to this node would have to be integrated by a contributor of this node (else, all existing flows would have to be recreated with the patched node, which I don't think is feasible). Any contributor active, @floetenbaer , @osos , @ssadams11 , @sadmin91 , @rainerCH that would be willing to do that? |
Do you upload this version to use the refresh token in the netatmo node? |
Hi all, https://dev.netatmo.com is now delivering both tokens. |
But, how many time is this token valid? And, the node is not prepared for input the refresh token and auto refresh it every x hours, isn't it? |
Correct, the access token must be refreshed periodically by the plugin and the plugin must be updated but no contributor is joining us. |
A bad sign for this plugin:
|
Will be fix for this? :( |
Have you see the announcement from Netatmo for the API use? Is this node already use this method?
The text was updated successfully, but these errors were encountered: