Skip to content

JeroenvIS/netatmo-auth-app

 
 

Repository files navigation

pre-commit.ci status

netatmo-auth-app

An example oauth2 workflow for using the netatmo API.

installation

via ssh

pip install git+ssh://git@github.com/jkittner/netatmo-auth-app

via https

pip install git+https://github.com/jkittner/netatmo-auth-app

usage

  1. setup your app

    • create a file called netatmo_app.json with this structure in your current working directory
      {
        "name": "<name of the app>",
        "redirect_uri": "http://localhost:5000/auth-callback",
        "client_id": "<client_id>",
        "client_secret": "<client_secret>"
      }
    • set the file permissions to -rw-------
      chmod 600 netatmo_app.json
    • the redirect_uri must match your netatmo app's settings
  2. run the app

  3. log into your account

    1. click Login to Netatmo. You will be redirected to the Netatmo page
    2. Enter your email and password and click LOG IN
    3. Click YES, I ACCEPT to allow access to our third-party app
    4. You will be redirected to the local authorization app which now has an access token and a refresh token (blurred for your safety). You have to click on the blur to remove it and show the token in plain text.
    5. A button shows up, which you can use to refresh the token
  4. a file called .netatmo_token is now created in your current working directory, which will contain the access token, the refresh token, and the expiry timestamp. Make sure you never check in this file -- add it to your .gitignore

  5. You can use the token in your scripts like this:

from netatmo_auth_app import OAuth2Token

token = OAuth2Token.from_file()
if token.expired:
    token.refresh()

About

a tool to log into netatmo via oauth2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%