Skip to content
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

another change of authorization method #5

Open
jawilczek opened this issue Jul 14, 2023 · 0 comments
Open

another change of authorization method #5

jawilczek opened this issue Jul 14, 2023 · 0 comments

Comments

@jawilczek
Copy link

Hi

two days ago, netatmo will turn off the old authorization method - which it warned about
i made small changes following [https://github.com/philippelt/netatmo-api-python] in the code and it's ok

"BREAKING CHANGE: Netatmo seems no longer (july 2023) to allow grant_type "password", even for an app credentials that belong to the same account than the home. They have added the capability of creating access_token/refresh_token couple from the dev page (the location where app are created). As a consequence, the username/password credentials can no longer be used and you must replace them with a new parameter REFRESH_TOKEN that you will get from the web interface. "

Below is the concept - not the complete code


# ------------------------------------------------------                                                                                                                                                 
# Parsing Arguments                                                                                                                                                                                      
# ------------------------------------------------------                                                                                                                                                 
ID=$1                                                                                                                                                                                                    
SEC=$2                                                                                                                                                                                                   
TOKEN=$3           

ACCESS_TOKEN=`curl --silent  --location --request POST "https://api.netatmo.com/oauth2/token" \                                                                                                          
                    --form "grant_type=refresh_token" \                                                                                                                                                  
                    --form "client_id=$ID" \                                                                                                                                                             
                    --form "client_secret=$SEC" \                                                                                                                                                        
                    --form "refresh_token=$TOKEN" | jq -r '.access_token'` 

# device list requested                                                                                                                                                                                      

if [ "${list_devices}" == "1" ] ; then
if hash jq >/dev/null 2>&1 ; then
listDevices "${id}" "${sec}" "${refresh}" | jq '.'
else
listDevices "${id}" "${sec}" "${refresh}"
fi
exit 0
fi


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant