tesla icon indicating copy to clipboard operation
tesla copied to clipboard

Commands returning 403 forbidden

Open sushi86 opened this issue 1 year ago • 6 comments

Hey,

I can succesfully login and retrieve vehicle information, but as soon as I want to send a command like start charging or lock doors, I get "403 Forbidden".

I created the access_token and refresh_token via the iOS App "Auth for Tesla".

Do I need something else?

Example Code:

c, err := tesla.NewClient(ctx, tesla.WithTokenFile(tokenPath)) if err != nil { return err }

vehicles, err := c.Vehicles()
if err != nil {
	return err
}

for i, v := range vehicles {
	if i > 0 {
		fmt.Println("----")
	}

	wakeup, err := v.Wakeup()
	if err != nil {
		fmt.Println("Wake up err")
		fmt.Println(err)
	}

	fmt.Println(wakeup)

	fmt.Printf("ID: %x\n", v.ID)
	fmt.Printf("Name %s\n", v.DisplayName)

	enabled, err := v.MobileEnabled()
	fmt.Println(enabled) <--- True
	if err != nil {
		fmt.Println("mobile enabled err")
		fmt.Println(err)
	}

	err = v.LockDoors() <--- 403 Forbidden
	if err != nil {
		return err
	}

Thanks for your help!

sushi86 avatar Dec 30 '23 12:12 sushi86

Seems like it has something to do with the new Third Party API, right (https://www.tesla.com/developer-docs)?

Does this API Wrapper already supports this?

sushi86 avatar Dec 30 '23 12:12 sushi86

It doesn't and it likely won't. Tesla Vehicle Commands is a separate API.

andig avatar Dec 30 '23 12:12 andig

Thanks for your reply. So this api wrapper won’t be able to send commands any more. 😞

sushi86 avatar Dec 30 '23 13:12 sushi86

It will as long as the owners api works.

andig avatar Dec 30 '23 13:12 andig

Then what I‘m doing wrong?

sushi86 avatar Dec 30 '23 13:12 sushi86

sad

sushi86 avatar Jan 16 '24 12:01 sushi86