Hello @pierre-gilles,
Could you provide us a callback route for an OAUTH2 API authentication?
We have started development of the Tesla fleet integration, but the origin URLs and redirect URIs for authorization can only be public HTTPS URLs, if I understand correctly, which means we can only use it via Gladys Plus, unlike Netatmo.
To make OAuth authorization work, you must declare in your Tesla application the same redirect_uri that you use when calling /authorize. Without that, the server will systematically refuse your URL`` Tesla does not accept HTTP URLs (or a local IP), you can expose your Gladys instance over HTTPS via a tunnel (ngrok, localtunnel…) and register the public URL provided by the tunnel.`
I did try with the local address http://localhost:1444/dashboard/integration/device/tesla/setup, it works and we can log in to the account, but it redirects me back to that address which means it won’t work in production.
Hi @Terdious,
I thought you were using Tessie?
If you want to use Tesla Fleet via Gladys Plus, I need you to answer several questions to determine which integration model we’ll go with 
On the Tesla Fleet API side:
- Is it complex to create a Tesla Fleet application?
- Does Tesla allow multiple applications to use the same redirect URLs?
- Is the API primarily intended for businesses or also for individuals?
- Are the generated tokens specific to each user, with access restricted to that user’s vehicles only?
On the Gladys Plus side, 2 possibilities:
- Each user creates their own Tesla Fleet application.
- A centralized Tesla application is created by Gladys Assistant SAS, similar to the current integration with Enedis.
If you want to discuss it live, I’m available today 
1 Like
Hehe !!
Me, yes, for the moment anyway, but the app is expensive. I think it’s well suited for mobile. But several people were wondering whether it would be possible to go directly through Tesla Fleet (I’m thinking of @tiboys, for example). And @S-Axel would also be more interested. Me too.
I won’t confirm anything for sure. But :
- Is it complex to create a Tesla Fleet application? As simple as for Netatmo.
- Does Tesla allow multiple applications to use the same redirect URLs? Good question …
- Is the API mainly intended for businesses or also for individuals? They state « (recommended for businesses only) » on the second option.
And in the API description, they do talk about keeping control over your vehicle for all owners.
- Are the generated tokens specific to each user, with access restricted to their own vehicles? Practically 100% sure since you create your own application!
With great pleasure as always, tell me when. On my side I might just be interrupted by my daughter ^^ We can quickly talk about the units as well if you want.
PS: ChatGPT tip otherwise - but not viable for us ^^
Another question: Is the Tesla Fleet API only in the direction « Gladys → Tesla » or is there a webhook mechanism or can Tesla contact Gladys?
Because actually, if there is no webhook, and it’s just for doing OAuth, it’s not on the backend that I have to create an API route, it’s you, when developing in Gladys, who must add a page in the front (on plus.gladysassistant.com) which will then be accessible via Gladys Plus 
You will just need to make sure that the page only works if the frontend is via Gladys Plus!
Yes, there is a webhook, that was exactly the following request ^^ Tesla Fleet Telemetry: https://developer.tesla.com/docs/fleet-api/fleet-telemetry
@Terdious Tesla Fleet is it for communicating directly with the Tesla servers without going through third-party apps?
De mon côté j’utilise ABRP (free) pour me connecter et récupérer some info from the Tesla, are we talking about the same kind of operation but from Gladys directly? If so then I’m interested!
Chez HA, they’ve put alerts about the potential cost of using it.
Yes, that’s exactly it! Except that, unlike ABRP, it also includes commands and all the information.
Yes, indeed, that’s why we have to test. But normally with proper use there should be no problem.
Regarding costs, if you don’t enter a credit card (CB), no problem, it’s just blocked afterwards. In short, everyone is in control.
Then there is Fleet Telemtry which is much broader, apparently, since it’s live data that
1 Like
[quote="Terdious, post:5, topic
Sorry, I don’t understand then… am I just using, like in Enedis, the variable gladysgateway?
Because in the code I see :
getRedirectUri = async () => {
try {
if (!this.props.session.gatewayClient) {
this.setState({
notOnGladysGateway: true
});
return;
}
const response = await this.props.session.gatewayClient.initializeEnedis();
this.setState({
redirectUri: response.redirect_uri
});
} catch (e) {
console.error(e);
}
};
But that calls a function that I don’t have for Tesla: ‹ initializeEnedis ›
No, the Enedis integration has nothing to do with it.
You just need a redirect URL, it’s frontend, not backend 
We already have that case in the Alexa and Google Home integration in the front-end code.
You have URLs:
/dashboard/integration/device/alexa/authorize
Which are accessible only through Gladys Plus
You just need to create your integration and define a URL:
/dashboard/integration/device/tesla-fleet/authorize
And then you do your thing on that page, but it’s clearly frontend 
To test locally, ngrok can be handy!
1 Like
Okay! I’m testing this!!
Mmmh I have a Gladys Plus for development ^^
Hi @pierre-gilles,
All good, we managed to connect to localhost.
2 Likes