Invalid access token

tom.wideroe

So, struggling with getting this response:

{
  "error": {
    "code": 2,
    "message": "Invalid access token"
}

Start by getting code:

https://api.netatmo.com/oauth2/authorize?client_id=xxx&redirect_uri=http://xxx/netatmo.html&scope=read_station&state=xxx

Using PHP, I'm downloading the tokens:

{"access_token":"xxx","refresh_token":"xxx","expires_in":10800,"expire_in":10800,"scope":["read_station"]}

Finally I'm using a bash script to download the data:

url="https://api.netatmo.com/api/getstationsdata?get_favorites=false"

curl -s -X GET "$url" \
  -H "Accept: application/json" \
-H "Authorization: Bearer [access_token]"

So this is where I get the invalid access token message...

What am I doing wrong?

0

Commentaires

2 commentaires

  • Comment author
    tom.wideroe

    Solved it by creating a new app

    0
  • Comment author
    evgeni.anchuk

    I have very similar issue. I got something like userId instead of access_token and refresh_token in the response

    Generated auth URL: https://api.netatmo.com/oauth2/authorize?client_id=66bbbXXXXXXXXXX&redirect_uri=http://localhost:8099/netatmo/redirect&scope=read_station read_magellan write_magellan read_bubendorff write_bubendorff read_smarther write_smarther read_thermostat write_thermostat read_doorbell access_doorbell read_mx write_mx read_homecoach&state=614dc582-60f3-42da-88f8-ed2997c81ad8

    2025-09-24T12:15:46.995+02:00  INFO 74074 --- [homecontrol] [nio-8099-exec-6] c.a.h.s.netatmo.NetatmoAuthClientConfig  : Body: {"access_token":"64e25a3ee0XXXXXXXXX|501357a0e62aeeXXXXXXXXX","refresh_token":"64e25a3ee00XXXXXXXX|76a1fc34cdc7aXXXXXXXXXX","expires_in":10800,"expire_in":10800,"scope":["read_station","read_magellan","write_magellan","read_bubendorff","write_bubendorff","read_smarther","write_smarther","read_thermostat","write_thermostat","read_doorbell","access_doorbell","read_mx","write_mx","read_homecoach"]}

    0

Vous devez vous connecter pour laisser un commentaire.