在编写任何针对Tesla API的实际代码之前,我想我应该破解一些cURL命令来熟悉一下。我已经很吃力了。只是想通过以下方式取回一个oauth令牌:
curl -X POST -H 'Content-Type: application/json' -d '{"grant_type": "password", "client_id": "81527cff06843c838fe1e431c2ef2106796384", "client_secret": "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3", "email": "myemail@email.com","password": "mypassword"}' 'https://owner-api.teslamotors.com/oauth/token'
产生以下错误:
{"error":"invalid_client","error_description":"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."}
我怀疑可能是在https://tesla-api.timdorr.com/api-basics/authentication上共享的client_id和client_secret被撤销了,但是当我尝试注册一个给我一个不同的对的smartcar帐户时,这对我也不起作用。
2条答案
按热度按时间tzdcorbm1#
这个命令可以正常工作,我只是在复制/粘贴它的时候把client_id搞砸了。在这里留下正确的版本,以防其他人想绕过Tesla API。
然后使用收到的令牌进行get查询:
然后道:
ewm0tg9j2#
我编写了这些简单的python脚本来访问具有最新需求的tesla api,这些脚本可以用来让任何人开始使用api。
https://github.com/Marky0/tesla_api_lite