Code Monkey home page Code Monkey logo

Comments (8)

andig avatar andig commented on August 16, 2024

Similar issues all around, see teslamate-org/teslamate#1412 and teslamate-org/teslamate@9fee2b5 for a fix. I was wondering if the Useragent is really required or if it shouldn‘t be enough to use the same UA as the official app?

from tesla.

andig avatar andig commented on August 16, 2024

@uhthomas according to https://golang.org/pkg/net/http/ it should be possible to set accept-encoding: gzip without the need to add a custom transport (check docs on DisableCompression). That would play more nicely with users providing their own client.

from tesla.

andig avatar andig commented on August 16, 2024

I can confirm that the changes are working. The transport is needed to inject the user agent into the login process and not only afterwards.

@uhthomas I'd be happy to integrate this with #43, or do you want to take a stab?

from tesla.

uhthomas avatar uhthomas commented on August 16, 2024

I think the Go HTTP client will send the Accept-Encoding: gzip header by default, but I had to specify the other fields for it to work.

There are some more complications, it looks like the clients are heavily rate-limited. Whether it's by IP, token or what, I don't know.

image

The graph shows points in time for where the exporter was able to get through, and where it wasn't. The error becomes

  | 2021-03-11 10:37:40 | 2021/03/11 10:37:40 list vehicles: do: Get "https://owner-api.teslamotors.com/api/1/vehicles": oauth2: cannot fetch token: 403 Forbidden
  | 2021-03-11 10:37:40 | Response: <HTML><HEAD>
  | 2021-03-11 10:37:40 | <TITLE>Access Denied</TITLE>
  | 2021-03-11 10:37:40 | </HEAD><BODY>
  | 2021-03-11 10:37:40 | <H1>Access Denied</H1>
  | 2021-03-11 10:37:40 |  
  | 2021-03-11 10:37:40 | You don't have permission to access "http&#58;&#47;&#47;auth&#46;tesla&#46;com&#47;oauth2&#47;v3&#47;token" on this server.<P>
  | 2021-03-11 10:37:40 | Reference&#32;&#35;18&#46;5d2b1102&#46;1615459060&#46;61779f9
  | 2021-03-11 10:37:40 | </BODY>
  | 2021-03-11 10:37:40 | </HTML>

from tesla.

andig avatar andig commented on August 16, 2024

Cannot fetch token sounds as if its actually logging in at that time. That should only happen very rarely?

from tesla.

uhthomas avatar uhthomas commented on August 16, 2024

It happens quite often - these OAuth2 tokens only live for a short while.

from tesla.

andig avatar andig commented on August 16, 2024

@uhthomas should I merge your changes with #43?

from tesla.

andig avatar andig commented on August 16, 2024

Closed in #43

from tesla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.