GithubHelp home page GithubHelp logo

Comments (8)

fredli74 avatar fredli74 commented on May 28, 2024 1

Solved in f0daaea

from fetch-tesla-token.

fredli74 avatar fredli74 commented on May 28, 2024

Thank you. Yeah, this kinda throws a wrench into the simple API I have today, as it will require a challenge-response kind of interaction.

I will find a fix for this as my users on smartcharge.dev needs it. But I might come up with a different solution. How are you using this API/project today?

from fetch-tesla-token.

dranreb38 avatar dranreb38 commented on May 28, 2024

+1 idem
:(

from fetch-tesla-token.

fredli74 avatar fredli74 commented on May 28, 2024

Just pushed a new updated version. Let me know if it works.

Unfortunately, this made the authentication flow a lot more complicated if you are using the API. It now goes something like this:

const { session, htmlForm } = await teslaAuth.newSession();

htmlForm.identity = input.email;
htmlForm.credential = input.password;

if (htmlForm.captcha !== undefined) {
  if (input.captcha) {
    htmlForm.captcha = input.captcha;
  } else {
    const captchaURI = await teslaAuth.getCaptcha(session);
    // User intervention needed to solve the captcha
    return captchaURI;
  }
}

if (input.mfa) {
  await teslaAuth.validateFactors(session, input.mfa, htmlForm.transaction_id);
}

const authCode = await teslaAuth.authenticate(session, htmlForm);

const bearerToken = await teslaAuth.bearerToken(authCode, session.codeVerifier);

const ownerToken = await teslaAuth.ownerapiToken(bearerToken.access_token);

from fetch-tesla-token.

fredli74 avatar fredli74 commented on May 28, 2024

It might be possible that you can always request a captcha to streamline the flow in two steps. But I have not tested it, as I went the totally different way for my service and only asking for captcha and mfa if it is required.

const { session, htmlForm } = await teslaAuth.newSession();
const captchaURI = await teslaAuth.getCaptcha(session);

// Show captcha and ask user for input

htmlForm.identity = input.email;
htmlForm.credential = input.password;
htmlForm.captcha = input.captcha;
...

from fetch-tesla-token.

IMgoRt avatar IMgoRt commented on May 28, 2024

Working for me, including captcha which is randomly back on today for me

from fetch-tesla-token.

dranreb38 avatar dranreb38 commented on May 28, 2024

It's ok for me , but error error 400 Bad request (with MFA) .
Screenshot_252

from fetch-tesla-token.

IMgoRt avatar IMgoRt commented on May 28, 2024

Working for me, including captcha which is randomly back on today for me

Mine also has MFA enabled, passed without issue

from fetch-tesla-token.

Related Issues (4)

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.