TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker and becoming a Supporting Member. For more info: Support TMC

Tesla login-token generator

Discussion in 'Model S: User Interface' started by VerityZooms, Jul 15, 2017.

  1. VerityZooms

    VerityZooms Member

    Joined:
    Apr 19, 2016
    Messages:
    131
    Location:
    Chicago, IL
    Hey, thought I'd throw this out there real quick: if you're using something like TeslaLog or the My Tesla Alexa-skill, and need an authentication token, I've thrown together a little self-installing tool to generate them quickly. (It doesn't store them anywhere, or contact any servers other than Tesla's — so no giving out your Tesla password to random websites, which is A Good Thing™.)

    If you're a developer like myself, and already have recent npm, you can just use the new npx tool to run this without any installation:
    Code:
    npx generate-tesla-token
    If you have no idea what any of that means, you can open the Terminal application on your Mac, and type these two lines:
    Code:
    npm install -g generate-tesla-token
    generate-tesla-token
    [​IMG]

    (And no, that isn't a working login token in the screenshot. ;))
     
    • Helpful x 2
    • Like x 1
    • Love x 1
  2. DOCAL

    DOCAL Member

    Joined:
    May 5, 2016
    Messages:
    328
    Location:
    San Jose, CA
    Fun, spoilt :(
     
  3. HankLloydRight

    HankLloydRight Fluxing

    Joined:
    Jan 18, 2014
    Messages:
    10,460
    Location:
    Connecticut
    Nice job.

    Since a lot of people are installing VisibleTesla just to get their list of option codes (and new drive unit code), maybe when you get the token, also grab their options list and optionally display it?
     
  4. dwploc

    dwploc Member

    Joined:
    Jun 28, 2017
    Messages:
    29
    Location:
    Atascocita, Tx
    Tried but err
    (xenial)[email protected]:~/aumc-test$ npx generate-tesla-token
    npx: installed 161 in 14.003s
    Unexpected token function
     
  5. kirkbauer

    kirkbauer Member

    Joined:
    May 31, 2015
    Messages:
    591
    Location:
    Atlanta, GA
    I'm also getting "Unexpected token function"
     
  6. GaryREM

    GaryREM Member

    Joined:
    Jul 16, 2013
    Messages:
    565
    Location:
    Fairfax, VA
    You need to update nodejs to latest. Using v8 of nodejs will work.
     
  7. dwploc

    dwploc Member

    Joined:
    Jun 28, 2017
    Messages:
    29
    Location:
    Atascocita, Tx
    Thanks, I had updated to npm v5.0.3 and node v8.1.4 Now it works great.
     
  8. VerityZooms

    VerityZooms Member

    Joined:
    Apr 19, 2016
    Messages:
    131
    Location:
    Chicago, IL
    Yeah, I'm a lazy buttface, and just knocked this together on a whim — didn't bother testing in older versions. I'm sure I used some ES2016-ism or something by accident.

    I'm happy to accept any pull-request — don't even have to make it pretty; just click the link and fix whichever line's erroring:

    Build software better, together
     
  9. VerityZooms

    VerityZooms Member

    Joined:
    Apr 19, 2016
    Messages:
    131
    Location:
    Chicago, IL
    Sounds out-of-scope, tbh. That said, a generalized npm install -g tesla tool, based on TeslaJS but with a consistent CLI and configstore token-caching, would probably be a well-received project … and given that TeslaJS has done all the hard work, wouldn't be at all difficult to throw together, if you wanted to! <3
     
  10. ahmadr

    ahmadr Member

    Joined:
    Sep 2, 2016
    Messages:
    12
    Location:
    NorCal
  11. Grioflorido

    Grioflorido New Member

    Joined:
    Jul 29, 2018
    Messages:
    2
    Location:
    Philippines
    i cant find a way to create a token.
     
  12. HankLloydRight

    HankLloydRight Fluxing

    Joined:
    Jan 18, 2014
    Messages:
    10,460
    Location:
    Connecticut

Share This Page

  • About Us

    Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.
  • Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


    SUPPORT TMC