Authorization using git bash

倾然丶 夕夏残阳落幕 提交于 2019-12-10 10:38:47

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/24587781/authorization-using-git-bash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!