**Working** PHP to Generate Refresh Token (Steps 1-4) #288
Replies: 33 comments 49 replies
-
Thanks to Stephan Groen for the original class https://github.com/stephangroen/tesla-php-client Confirmed to work on https://www.esherpa.ch Tesla Carsharing ;-) |
Beta Was this translation helpful? Give feedback.
-
Should we anticipate that the integration will eventually integrate this, or something similar, so it all just works as it should again someday? |
Beta Was this translation helpful? Give feedback.
-
I was wondering because of this "set-cookie" problem. i changed the code to: if (isset($headers['Set-Cookie'])){
$cookie = $headers['Set-Cookie'];
} elseif (isset($headers['set-cookie'])){
$cookie = $headers['set-cookie'];} |
Beta Was this translation helpful? Give feedback.
-
When I run this on a Windows 10 machine I get the following error. Am I doing something daft ? Fatal error: Uncaught Error: Call to undefined function curl_init() in C:\PHP\generateV3TeslaRefreshToken1.php:509 |
Beta Was this translation helpful? Give feedback.
-
Use these lines at end of code to create a Tesla OAuth Proxy, which your existing app can use in replacement of deprecated endpoint without changing app code:
|
Beta Was this translation helpful? Give feedback.
-
Getting the following, any suggestions?
|
Beta Was this translation helpful? Give feedback.
-
Not working for me :-( The script fails for me with the output. PHP Warning: Trying to access array offset on value of type null in /home/derek/bin/tesla-token.php on line 350
PHP Warning: Trying to access array offset on value of type null in /home/derek/bin/tesla-token.php on line 351
PHP Warning: Undefined array key "access_token" in /home/derek/bin/tesla-token.php on line 375
array(2) {
["response"]=>
string(17) "invalid_sso_token"
["refresh_token"]=>
NULL
} By uncommenting the print statement on line 323 I got more info on the error
The login credentials are given correctly on line 519, and I can log in to my account without any problem on the web site. |
Beta Was this translation helpful? Give feedback.
-
I updated the script with my Tesla login details and ran it in a PHP docker container. The script ran successfully and emitted a token. All good - but when I wanted to test it with TeslaFi I get "Your token could not be verified. Please make sure you entered your token correctly." what could be wrong? |
Beta Was this translation helpful? Give feedback.
-
not working anymore :(
|
Beta Was this translation helpful? Give feedback.
-
not working for me either. |
Beta Was this translation helpful? Give feedback.
-
Same. Not working for me either.
|
Beta Was this translation helpful? Give feedback.
-
No workie workie for me either |
Beta Was this translation helpful? Give feedback.
-
I found one problem. There are now two cookies that must be retrieved from step 1: tesla-auth.sid and ak_bmsc. As written, the code only retrieves one cookie, ak_bmsc. After fixing that problem, I received HTTP 302 on step 2 (as expected), but I'm running into another problem now. Still working on a fix. |
Beta Was this translation helpful? Give feedback.
-
Im hanging at STEP1. I tried your code with the cacert.pem CURLOPT_CAINFO:
$GetUrl = $this->accessUrl.'?'.http_build_query ($data);
$certpath = plugin_dir_path( __FILE__ ) .'/cacert.pem';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $GetUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_CAINFO, $certpath);
$apiResult = curl_exec($ch);
I downloaded a cacert.pm upload it to the WP-plugin folder.
Or do i need to send the certificate from my website?
Is this the right way?
… Am 18.03.2021 um 03:04 schrieb apach3guy ***@***.***>:
*** SOLVED ***
Note: Please update the path to your cacert.pem
`<?php
class Tesla
{
protected $apiBaseUrl = "https://owner-api.teslamotors.com/api/1 <https://owner-api.teslamotors.com/api/1>";
protected $tokenUrl = 'https://owner-api.teslamotors.com/oauth/token <https://owner-api.teslamotors.com/oauth/token>';
protected $tokenUrlNew = 'https://auth.tesla.com/oauth2/v3/token <https://auth.tesla.com/oauth2/v3/token>';
protected $accessUrl = 'https://auth.tesla.com/oauth2/v3/authorize <https://auth.tesla.com/oauth2/v3/authorize>';
protected $UA = "Mozilla/5.0 (Linux; Android 10; Pixel 3 Build/QQ2A.200305.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.81 Mobile Safari/537.36";
protected $X_TESLA_USER_AGENT = "TeslaApp/3.10.9-433/adff2e065/android/10";
protected $accessToken;
protected $vehicleId = null;
public function __construct(string $accessToken = null)
{
$this->accessToken = $accessToken;
}
public function setAccessToken(string $accessToken)
{
$this->accessToken = $accessToken;
}
public function allData()
{
return $this->sendRequest('/vehicle_data')['response'];
}
public function vehicles()
{
return $this->sendRequest('/vehicles')['response'];
}
public function vehicle()
{
return $this->sendRequest('')['response'];
}
public function setVehicleId(int $vehicleId)
{
$this->vehicleId = $vehicleId;
}
public function setClientId(string $clientId)
{
putenv('TESLA_CLIENT_ID=' . $clientId);
}
public function setClientSecret(string $clientSecret)
{
putenv('TESLA_CLIENT_SECRET=' . $clientSecret);
}
public function mobileEnabled()
{
return $this->sendRequest('/mobile_enabled')['response'];
}
public function chargeState()
{
return $this->sendRequest('/data_request/charge_state')['response'];
}
public function climateState()
{
return $this->sendRequest('/data_request/climate_state')['response'];
}
public function driveState()
{
return $this->sendRequest('/data_request/drive_state')['response'];
}
public function guiSettings()
{
return $this->sendRequest('/data_request/gui_settings')['response'];
}
public function vehicleState()
{
return $this->sendRequest('/data_request/vehicle_state')['response'];
}
public function vehicleConfig()
{
return $this->sendRequest('/data_request/vehicle_config')['response'];
}
public function wakeUp()
{
return $this->sendRequest('/wake_up', [], 'POST')['response'];
}
public function startSoftwareUpdate( int $seconds = 0 )
{
return $this->sendRequest('/command/schedule_software_update', [ 'offset_sec' => $seconds ], 'POST')['response'];
}
public function setValetMode(bool $active = false, int $pin = 0000)
{
$params = [
'on' => $active,
'pin' => $pin
];
return $this->sendRequest('/command/set_valet_mode', $params, 'POST')['response'];
}
public function resetValetPin()
{
return $this->sendRequest('/command/reset_valet_pin', [], 'POST')['response'];
}
public function openChargePort()
{
return $this->sendRequest('/command/charge_port_door_open', [], 'POST')['response'];
}
public function setChargeLimitToStandard()
{
return $this->sendRequest('/command/charge_standard', [], 'POST')['response'];
}
public function setChargeLimitToMaxRange()
{
return $this->sendRequest('/command/charge_max_range', [], 'POST')['response'];
}
public function setChargeLimit(int $percent = 90)
{
$params = [
'percent' => "$percent"
];
return $this->sendRequest('/command/set_charge_limit', $params, 'POST')['response'];
}
public function startCharging()
{
return $this->sendRequest('/command/charge_start', [], 'POST')['response'];
}
public function stopCharging()
{
return $this->sendRequest('/command/charge_stop', [], 'POST')['response'];
}
public function flashLights()
{
return $this->sendRequest('/command/flash_lights', [], 'POST')['response'];
}
public function honkHorn()
{
return $this->sendRequest('/command/honk_horn', [], 'POST')['response'];
}
public function unlockDoors()
{
return $this->sendRequest('/command/door_unlock', [], 'POST')['response'];
}
public function lockDoors()
{
return $this->sendRequest('/command/door_lock', [], 'POST')['response'];
}
public function windowControl(string $state = 'close', int $lat = 0, int $lon = 0)
{
return $this->sendRequest('/command/window_control', [ 'command' => $state, 'lat' => $lat, 'lon' => $lon ], 'POST')['response'];
}
public function setTemperature(float $driverDegreesCelcius = 20.0, float $passengerDegreesCelcius = 20.0)
{
return $this->sendRequest('/command/set_temps?driver_temp=' . $driverDegreesCelcius . '&passenger_temp=' . $passengerDegreesCelcius, [], 'POST')['response'];
}
public function startHvac()
{
return $this->sendRequest('/command/auto_conditioning_start', [], 'POST')['response'];
}
public function stopHvac()
{
return $this->sendRequest('/command/auto_conditioning_stop', [], 'POST')['response'];
}
public function movePanoramicRoof(string $state = 'vent', int $percent = 50)
{
return $this->sendRequest('/command/sun_roof_control?state=' . $state . '&percent=' . $percent, [], 'POST')['response'];
}
public function remoteStart(string $password = '')
{
return $this->sendRequest('/command/remote_start_drive?password=' . $password, [], 'POST')['response'];
}
public function openTrunk()
{
return $this->sendRequest('/command/actuate_trunk', [ 'which_trunk' => 'rear' ], 'POST')['response'];
}
public function openFrunk()
{
return $this->sendRequest('/command/actuate_trunk', [ 'which_trunk' => 'front' ], 'POST')['response'];
}
public function setNavigation(string $location)
{
$params = [
'type' => 'share_ext_content_raw',
'value' => [
'android.intent.extra.TEXT' => $location
],
'locale' => 'en-US',
'timestamp_ms' => time(),
];
return $this->sendRequest('/command/navigation_request', $params, 'POST')['response'];
}
public function startSentry()
{
return $this->sendRequest('/command/set_sentry_mode', [ 'on' => True], 'POST')['response'];
}
public function stopSentry()
{
return $this->sendRequest('/command/set_sentry_mode', [ 'on' => False], 'POST')['response'];
}
public function setSeatHeater(int $heater = 0, int $level = 0)
{
return $this->sendRequest('/command/remote_seat_heater_request', ['heater' => $heater, 'level' => $level], 'POST')['response'];
}
public function setTemps(float $driver = 21.0, float $passenger = 21.0)
{
return $this->sendRequest('/command/set_temps', ['driver_temp' => $driver, 'passenger_temp' => $passenger], 'POST')['response'];
}
public function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
public function getAccessToken(string $username, string $password)
{
###Step 1: Obtain the login page
$code_verifier = substr(hash('sha512', mt_rand()), 0, 86);
$state = $this->base64url_encode(substr(hash('sha256', mt_rand()), 0, 12));
$code_challenge = $this->base64url_encode($code_verifier);
$data =[
'client_id' => 'ownerapi',
'code_challenge' => $code_challenge,
'code_challenge_method' => 'S256',
'redirect_uri' => 'https://auth.tesla.com/void/callback',
'response_type' => 'code',
'scope' => 'openid email offline_access',
'state' => $state,
];
$GetUrl = $this->accessUrl.'?'.http_build_query ($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $GetUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
curl_close($ch);
$dom = new DomDocument();
@ $dom->loadHTML($apiResult);
$child_elements = $dom->getElementsByTagName('input'); //DOMNodeList
foreach( $child_elements as $h2 ) {
$hiddeninputs[$h2->getAttribute('name')]=$h2->getAttribute('value');
}
$headers = [];
$output = rtrim($apiResult);
$data = explode("\n",$output);
$headers['status'] = $data[0];
array_shift($data);
$cookies = array();
foreach($data as $part){
//some headers will contain ":" character (Location for example), and the part after ":" will be lost, Thanks to @emanuele
$middle = explode(":",$part,2);
//Supress warning message if $middle[1] does not exist, Thanks to @crayons
if ( !isset($middle[1]) ) { $middle[1] = null; }
$headers[trim($middle[0])] = trim($middle[1]);
if (strpos(trim($middle[0]),"set-cookie") !== false) {
$cookie = explode(";",trim($middle[1]));
$cookies[] = $cookie[0];
}
}
$cookiestr = $cookies[0];
foreach($cookies as $i=>$cookie) {
if ($i == 0) continue;
$cookiestr .= ';' . $cookie;
}
###Step 2: Obtain an authorization code
for($i = 0; $i < 10; $i++) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $GetUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
$postData = array(
'_csrf' => $hiddeninputs['_csrf'],
'_phase' => $hiddeninputs['_phase'],
'_process' => $hiddeninputs['_process'],
'transaction_id' => $hiddeninputs['transaction_id'],
'cancel' =>$hiddeninputs['cancel'],
'identity' => $username,
'credential' => $password
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_COOKIE, $cookiestr);
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
curl_close($ch);
$code = explode('&',explode('https://auth.tesla.com/void/callback?code=',$apiResult)[1])[0];
if(!empty($code)) break;
sleep(1);
}
###Step 3: Exchange authorization code for bearer token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->tokenUrlNew);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json',
'User-Agent: ' . $this->UA,
'X-Tesla-User-Agent: ' . $this->X_TESLA_USER_AGENT,
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'grant_type' => 'authorization_code',
'client_id' => 'ownerapi',
'code' => $code,
'code_verifier' => $code_verifier,
'redirect_uri' => 'https://auth.tesla.com/void/callback'
]));
curl_setopt($ch, CURLOPT_COOKIE, $cookiestr);
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
curl_close($ch);
$apiResultJson = json_decode($apiResult, true);
$BearerToken = $apiResultJson['access_token'];
$RefreshToken = $apiResultJson['refresh_token'];
###Step 4: Exchange bearer token for access token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->tokenUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer '.$BearerToken,
'Content-Type: application/json',
'User-Agent: ' . $this->UA,
'X-Tesla-User-Agent: ' . $this->X_TESLA_USER_AGENT,
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
'client_id' => getenv('TESLA_CLIENT_ID'),
'client_secret' => getenv('TESLA_CLIENT_SECRET'),
]));
curl_setopt($ch, CURLOPT_COOKIE, $cookiestr);
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
curl_close($ch);
$apiResultJson = json_decode($apiResult, true);
$apiResultJson['refresh_token']=$RefreshToken;
$this->accessToken = $apiResultJson['access_token'];
return $apiResultJson;
}
public function refreshAccessToken(string $refreshToken) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->tokenUrlNew);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json',
'User-Agent: ' . $this->UA,
'X-Tesla-User-Agent: ' . $this->X_TESLA_USER_AGENT,
]);
#print 'XX '.getenv('TESLA_CLIENT_ID');exit;
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'grant_type' => 'refresh_token',
'client_id' => 'ownerapi',
'client_secret' => getenv('TESLA_CLIENT_SECRET'),
'refresh_token' => $refreshToken,
'scope' => 'openid email offline_access'
]));
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
$apiResultJson = json_decode($apiResult, true);
curl_close($ch);
#print_r($apiResult);exit;
$apiResultJson = json_decode($apiResult, true);
$BearerToken = $apiResultJson['access_token'];
$RefreshToken = $apiResultJson['refresh_token'];
###Step 4: Exchange bearer token for access token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->tokenUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer '.$BearerToken,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
'client_id' => getenv('TESLA_CLIENT_ID'),
'client_secret' => getenv('TESLA_CLIENT_SECRET'),
]));
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
$apiResult = curl_exec($ch);
curl_close($ch);
$apiResultJson = json_decode($apiResult, true);
$apiResultJson['refresh_token']=$RefreshToken;
#print_r($apiResultJson);exit;
$this->accessToken = $apiResultJson['access_token'];
return $apiResultJson;
}
protected function sendRequest(string $endpoint, array $params = [], string $method = 'GET')
{
$ch = curl_init();
if ($endpoint !== '/vehicles' && ! is_null($this->vehicleId)) {
$endpoint = '/vehicles/' . $this->vehicleId . $endpoint;
}
curl_setopt($ch, CURLOPT_URL, $this->apiBaseUrl . $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CAINFO, '/PHP/cacert.pem');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json',
'User-Agent: Mozilla/5.0 (Linux; Android 9.0.0; VS985 4G Build/LRX21Y; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/58.0.3029.83 Mobile Safari/537.36',
'X-Tesla-User-Agent: TeslaApp/3.4.4-350/fad4a582e/android/9.0.0',
'Authorization: Bearer ' . $this->accessToken,
]);
if ($method == 'POST' || $method == 'PUT' || $method == 'DELETE') {
if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
}
if (in_array($method, ['PUT', 'DELETE'])) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
}
$apiResult = curl_exec($ch);
$headerInfo = curl_getinfo($ch);
$apiResultJson = json_decode($apiResult, true);
curl_close($ch);
$result = [];
if ($apiResult === false) {
$result['errorcode'] = 0;
$result['errormessage'] = curl_error($ch);
//print $result['errormessage'].' api<br>';
}
if (! in_array($headerInfo['http_code'], ['200', '201', '204'])) {
$result['errorcode'] = $headerInfo['http_code'];
if (isset($apiResult)) {
$result['errormessage'] = $apiResult;
}
//print $result['errormessage'].' header<br>';;
}
return $apiResultJson ?? $apiResult;
}
}
$t = new Tesla();
$t->setClientId('81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384');
$t->setClientSecret('c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3');
?>`
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#288 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACZ5TJD2ERJIUBIDE67EPOLTEFNSHANCNFSM4XBNFZYA>.
|
Beta Was this translation helpful? Give feedback.
-
I saw many people with problems so I re-downloaded this code and ran it on Windows with PHP 7.3.27. I got many errors. I figured this out a few months ago so I then went and added the line: curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); just before every line that has curl_exec($ch); and then it ran with no errors. Without it I get SSL errors which I don't care about. Separately in February until April 20th this code seems to fail with permission errors (sometimes). In February I brute forced a for loop around each step if it failed. When I run the code each step can take up to 20 times to come back with the data. The loop is only around the actual call so I am sending the same data over and over again. Then it succeeds. In the past this kind of hack was for fixing a problem with many servers behind a load balancer and some running different revisions of software, you keep requesting until you hit a server that works. So I'm leaving this retry code in just in case this problem comes back. But today the code comes back on the first try. |
Beta Was this translation helpful? Give feedback.
-
Sorry I should have noted around Wednesday this week it started working
again so maybe they had it on temporarily due to attack or high risk event.
…On Sat, 5 Jun 2021, 11:11 am fmezz, ***@***.***> wrote:
Well as of at least today the Captcha has been removed and this works
again.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#288 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUKXQ43ZVCQ6AIDRDZZ3ZLTRF2UPANCNFSM4XBNFZYA>
.
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I was trying today to generate a new Token, but I get this: have anyone also this problem again? Or is there an update for the Code? |
Beta Was this translation helpful? Give feedback.
-
It seems that sometimes Tesla enables captcha, sometimes on, sometimes off
- maybe if you're connecting from a high risk IP range or something.
I get my software to keep trying, eventually it gets a token in a 24hr
window and then as I understand it you can keep using that token for 45
days or something like that which has worked for us fine.
…On Thu, Jun 10, 2021 at 5:22 PM Lockwi ***@***.***> wrote:
Sorry, I was trying today to generate a new Token, but I get this:
array(2) { ["response"]=> string(17) "invalid_sso_token"
["refresh_token"]=> NULL }
have anyone also this problem again? Or is there an update for the Code?
THX for helping.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#288 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUKXQYEDRWI6B6VVFV2NLDTSBR45ANCNFSM4XBNFZYA>
.
--
Christopher Baker - 0438 362 873 - 03 9070 7979
Cloud Services (IP Phone, Web & Telephony), Office Solutions &
Onsite/Remote IT Support
Referrals are very important to us. If you know of any business that may
benefit from our professional services, please do not hesitate to contact
me. I would appreciate the opportunity to connect you with some of our most
experienced technicians.
|
Beta Was this translation helpful? Give feedback.
-
just keep trying, have it on loop for around 24hrs trying once every 5
minutes it will pick one up eventually. It has worked for us this way. I
got the exact same response you mentioned and we just left it until it
recollected a new token.
…On Thu, Jun 10, 2021 at 6:03 PM Lockwi ***@***.***> wrote:
Yes it worked fine in the past. It is right, you can use the token for ~45
days.
But since few days, I can´t generate a new token.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#288 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUKXQ65CH5S7RMLTQTPTJ3TSBWVPANCNFSM4XBNFZYA>
.
--
Christopher Baker - 0438 362 873 - 03 9070 7979
Cloud Services (IP Phone, Web & Telephony), Office Solutions &
Onsite/Remote IT Support
Referrals are very important to us. If you know of any business that may
benefit from our professional services, please do not hesitate to contact
me. I would appreciate the opportunity to connect you with some of our most
experienced technicians.
|
Beta Was this translation helpful? Give feedback.
-
Is this php code still working for people? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I am out of the office on Wednesday and will have limited
access to email.
If you can't wait please email ***@***.*** instead or telephone
the office on 01454 269 087.
Thanks
…--
T : +44 (0)1454 269 087
W : https://evergreencomputing.com
<https://evergreencomputing.com>
A : The Granary, Woodend Lane, Tortworth,
GL12 8AA
Click here to* *read how we helped with We Mean Biz's member
management and booking system
<https://evergreencomputing.com/case-study/wmb/We-Mean-Biz/>
This
communication is only for the use of the addressee. It may contain
information which is legally privileged, confidential and exempt from
disclosure. If you are not the intended recipient you must not read, copy,
distribute or disseminate this communication or any attachments to anyone
other than the addressee or use the information it contains. If you receive
this communication in error, please inform us by telephone at once. No
responsibility is accepted by Evergreen Computing Ltd for personal e-mails,
or e-mails unconnected with the Company's or clients' business.
Evergreen
Computing Ltd. Registered in England and Wales. Registered Number 3747553.
VAT Registration Number: 736603434.
|
Beta Was this translation helpful? Give feedback.
-
If it's any assistance to anyone, I have been working on a WordPress plugin to display Tesla vehicle information on my web site. The authentication code here https://github.com/petenelson/wp-tesla/blob/feature/authenticate-v3/includes/functions/api.php#L485 was written based on the docs in this repo https://github.com/timdorr/tesla-api/blob/master/docs/api-basics/authentication.md It was working a few weeks ago, but doesn't seem to be currently. Dropping this in here in case anyone finds it useful. |
Beta Was this translation helpful? Give feedback.
-
Hello again, Since about 1 week, I'm now blocked at step 1 with this message : I think I know the root cause : So, I have disabled Teslamate, waiting a solution from the author, but my own code using "Working PHP to Generate Refresh Token" is failing at step 1 … I hoped this will be working again after few days, but no … I observed that AuthAppForTesla iOS app is working fine on the same network, but perhaps the login on tesla servers is performed from a remote server, not coming from my personal IP ? My questions are : Thanks for your help |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a way to generate a new token (even if its a process
outside of the code, so I can just provide it manually and get another 45
days).
Thanks
|
Beta Was this translation helpful? Give feedback.
-
im only on android so thats rip
…On Sun, Sep 12, 2021 at 6:29 PM CARDON Pascal ***@***.***> wrote:
using AuthAppForTesla iOS app is solution that works for me
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#288 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUKXQ4HNM37IWOTLIG5KBLUBRQFTANCNFSM4XBNFZYA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
I downloaded - Is there any way to modify AuthAppForTesla so that it can be run with Xcode 9.4? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I am out of the office on Wednesday and will have limited
access to email.
If you can't wait please email ***@***.*** instead or telephone
the office on 01454 269 087.
Thanks
…--
T : +44 (0)1454 269 087
W : https://evergreencomputing.com
<https://evergreencomputing.com>
A : The Granary, Woodend Lane, Tortworth,
GL12 8AA
Click here to* *read how we helped with We Mean Biz's member
management and booking system
<https://evergreencomputing.com/case-study/wmb/We-Mean-Biz/>
This
communication is only for the use of the addressee. It may contain
information which is legally privileged, confidential and exempt from
disclosure. If you are not the intended recipient you must not read, copy,
distribute or disseminate this communication or any attachments to anyone
other than the addressee or use the information it contains. If you receive
this communication in error, please inform us by telephone at once. No
responsibility is accepted by Evergreen Computing Ltd for personal e-mails,
or e-mails unconnected with the Company's or clients' business.
Evergreen
Computing Ltd. Registered in England and Wales. Registered Number 3747553.
VAT Registration Number: 736603434.
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I am out of the office on Wednesday and will have limited
access to email.
If you can't wait please email ***@***.*** instead or telephone
the office on 01454 269 087.
Thanks
…--
T : +44 (0)1454 269 087
W : https://evergreencomputing.com
<https://evergreencomputing.com>
A : The Granary, Woodend Lane, Tortworth,
GL12 8AA
<https://evergreencomputing.com/case-study/keys/Nest-General-Insurance/>
Click here to read how we* *helped with Nest's custom CRM system
<https://evergreencomputing.com/case-study/keys/Nest-General-Insurance/>.
This communication is only for the use of the addressee. It may contain
information which is legally privileged, confidential and exempt from
disclosure. If you are not the intended recipient you must not read, copy,
distribute or disseminate this communication or any attachments to anyone
other than the addressee or use the information it contains. If you receive
this communication in error, please inform us by telephone at once. No
responsibility is accepted by Evergreen Computing Ltd for personal e-mails,
or e-mails unconnected with the Company's or clients' business.
Evergreen
Computing Ltd. Registered in England and Wales. Registered Number 3747553.
VAT Registration Number: 736603434.
|
Beta Was this translation helpful? Give feedback.
-
Does the refresh token last for 45 days? |
Beta Was this translation helpful? Give feedback.
-
Please can you tell me how you run AuthAppFor Tesla. I've upgraded my Mac so that it is now on Monterey (12.0.1), I've downloaded Xcode 13.1, and downloaded AuthAppForTesla from Github. Then I open the AuthAppForTesla.xcworkspace in Xcode and press play. It says Build Succeeded (5 Swift Compiler Warnings) but does not run anything. Please advise what I can do to run AuthAppForTesla. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Here's a complete working script created by @ralfonso4 in this thread: #283
(I've only fixed a case-sensitivity bug in the
set-cookie
header.) Edit: Apparently the header is lowercase or uppercase depending on the platform. I've updated this script to pull whichever one is present, using @ralfonso4's fix.Just change at the very bottom your
"login"
and"password"
to your tesla.com credentials and it will generate your access and refresh tokens.Confirmed to work in TeslaFi.com.
Edit. For those of you finding this through google, here's how to make it work on a Mac (similar for other *nix).
generateV3TeslaRefreshToken.php
.php
(with the space), then drag the file you created into the Terminal window. That will populate the complete path to the script."refresh_token"
.Beta Was this translation helpful? Give feedback.
All reactions