我正在尝试遵循嵌套设备访问快速入门指南,但我被困在此处的“获取访问令牌”步骤https://developers.google.com/nest/device-access/authorize#get_an_access_token
我正在 Windows 终端中运行该命令,与指南中显示的完全一样(除了我的 client_id、client_secret 和 authorization_code):
curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token?
client_id=oauth2-client-id&
client_secret=oauth2-client-secret&
code=authorization-code&
grant_type=authorization_code&
redirect_uri=https://www.google.com'
但它返回此错误:
<p><b>411.</b> <ins>That’s an error.</ins>
<p>POST requests require a <code>Content-length</code> header.
不知道我在标题中缺少什么。我在 Windows 10 机器上,以防万一。我知道它确实需要使用双引号而不是单引号。到处搜索,还没有找到答案。谢谢!