3

I've been trying to work with my Nest thermostat so I can work it into home automation run by my Arduino-based projects. So far, I've completely failed to get anything done. I would greatly appreciate input or redirection to other resources.

I signed up under the Nest developer and created a client with read/write permissions.

I'm at the OAuth step where I want to start pulling basic information out of thermostat. I went to https://home.nest.com/login/oauth2?client_id=[clientID]&state=STATE where clientID is the clientID for my project. I left STATE as is.

I received the PIN that I'll call 99ITPUMP and I put that into Git BASH like so:
curl POST https://api.home.nest.com/oauth2/access_token?code=99ITPUMP&client_id=[clientID]&client_secret=[clientSecret]&grant_type=authorization_code

The response I get is
$ curl: (6) Could not resolve host: POST {"url":"/oauth2/access_token?code=99ITPUMP","message":"404 Not Found"}

I've tried getting a new auth code multiple times and still can't get anything. Can anybody tell me what I'm doing wrong? I need to get basic information from my Nest within the bash console. For anyone providing an answer, please make it is idiot-proof as possible. I really have no idea what I'm doing so I'm doing my best to learn.

jfudgeelder
  • 423
  • 3
  • 13

1 Answers1

2

Try something like:

curl --data 'code=99ITPUMP&client_id=[clientID]&client_secret=[clientSecret]&grant_type=authorization_code' https://api.home.nest.com/oauth2/access_token

thesimm
  • 774
  • 3
  • 12
  • Thank you! For future users reading this thread, be sure to include the backticks (the little ` things). The response I got contained an access token of 146 numbers and letters, and an expiration time. – jfudgeelder Jul 06 '14 at 20:00
  • Note that these are NOT back ticks. – Michael Hausenblas Sep 21 '14 at 10:09
  • I tried but got the error: {"error":"oauth2_error","error_description":"authorization code not found","instance_id":"fefbb###"} – PerlDev Oct 12 '16 at 21:42