Tesla Api - 404 error trying to use refresh_token

325 Views Asked by At

I've been scratching my head over this bug for the last hour and was wondering if anyone could help me out. Here is the link to the tesla api: https://tesla-api.timdorr.com/api-basics/authentication

I've been trying to make a POST request to get a new access_token like such

data = urlencode({
            "grant_type": "refresh_token", "client_id": CLIENT_ID,
            "client_secret": CLIENT_SECRET, "refresh_token": refresh_token
        }).encode("utf-8")
    request = Request("https://owner-api.teslamotors.com/oath/token",
                      data=data)
    response = urlopen(request).read()

However, this keeps returning me a 404 error but I would like to think that I am making the POST request correctly. Can someone point out what I'm missing here? I'm confident that all my variables (CLIENT_ID, CLIENT_SECRET, etc) are correct too

Would appreciate any help :-)

Thanks!

0

There are 0 best solutions below