teslamotors / fleet-telemetry

Apache License 2.0
625 stars 66 forks source link

Can't add public key to vehicule #173

Open themarch opened 1 month ago

themarch commented 1 month ago

I got this when I wanted to add the public key to the vehicle. However, I do have access to this vehicle, and I can make API calls on it etc. And I've already done the ‘third_party’ and ‘authorization_code’ parts. (also with vehicle_device_data scope)

Maybe it's another zone problem? (for the translation of the pictures it's : The vehicle cannot be shared. Adding a virtual key for ‘bib-data.fr’ is prohibited because you have not granted ‘bib-data.fr’ access to your account.)

Capture d’écran 2024-05-29 à 09 32 53

But as you can see, on the client account, all is link with "bib-data.fr"

Screenshot 2024-05-27 at 13 50 47 (1)

themarch commented 1 month ago

Okay @patrickdemers6 I tried with another vehicle (which has a more recent software version and it works), this must have an impact.

patrickdemers6 commented 1 month ago

This error occurs when you haven't gone through all the authorization code flow steps. Vehicle firmware has nothing to do with it.

When you did a different vehicle, was it on a different account?

patrickdemers6 commented 1 month ago

I believe it's also possible this happens when your server can't be accessed from the mobile app when it validates public key.

themarch commented 1 month ago

I'm really surprised because I did the EXACT same process, so all the authorization code flow steps. I did it 2 minutes apart and I did it several times. And with one it never worked, always the same error. And with the other it always worked. Yes, it's a different account. @patrickdemers6

patrickdemers6 commented 1 month ago

Can you email fleetapisupport@tesla.com with the two email addresses you tried? Make sure to call out which one is working and which one isn't.

SirArkimedes commented 1 month ago

@patrickdemers6 We've had this occur on almost all of our accounts that both:

  1. owned vehicles and
  2. were some of the first accounts that authorized our application.

Based on what we were seeing, we kinda suspected that this started occurring around the time that we were able to retroactively change scopes without revoking the application and re-adding it.

Our (hopefully temporary) workaround has been to revoke the application and re-authenticate.

patrickdemers6 commented 1 month ago

Thanks for letting me know. Narrowing down the timeline of this starting helps a lot. If you can also email any additional details to me, it will help with investigating.

themarch commented 1 month ago

I've asked for the email address of the second account, but I don't have it directly. I'll send you an email as soon as I have all the information, detailing everything.

We've already tried deleting revoke the application and re-authenticate but no change.

Thanks in advance!

themarch commented 1 month ago

I've just emailed you the information! @patrickdemers6

paede81 commented 1 month ago

Faceing the exact same issue, any advice what should I test/try? @patrickdemers6 I followed exactly the instruction you provided

patrickdemers6 commented 3 weeks ago

Sorry for the delay everyone, I'm struggling to identify the issue. Can someone reproduce it again and share VIN/email? I know you already have, but I want to dig into the logs while they're fresh.

cc @themarch @paede81

themarch commented 2 weeks ago

Hi @patrickdemers6 I've just tried it out and same error ! For the VIN: LRWYGCFS6PC552861 And email: cv.lapeyre@orange.fr

paede81 commented 2 weeks ago

Hi @patrickdemers6 VIN: LRW3E7EK5MC400705 Email: patrick.steiner@gmx.ch

I have an idea: could the issue be related to the endpoints and regional requirements?

I registered it via https://fleet-api.prd.na.vn.cloud.tesla.com/ But my car is located in Europe. After I realised my mistake I raised a new request with https://fleet-api.prd.eu.vn.cloud.tesla.com/ And wait for the answer from Tesla.

@themarch could it be the same with you, as it seems you live also in Europe?

paede81 commented 2 weeks ago

Sorry for the delay everyone, I'm struggling to identify the issue. Can someone reproduce it again and share VIN/email? I know you already have, but I want to dig into the logs while they're fresh.

cc @themarch @paede81

Tried it right now but still the same issue

patrickdemers6 commented 2 weeks ago

Thanks all.

@paede81 I don't see that you've granted an application access to that email. Can you confirm you've gone through full authorization flow?

@themarch you have granted that email address access to the application; however, it looks like the mobile app is signed in with an email beginning with pa. Can you make sure you're using the same email for authorization flow and in the mobile app?

themarch commented 2 weeks ago

I think that's it @patrickdemers6 I'll give it a go, but in fact: the tesla is X with X account.

But I sent the QRCode to be scanned to a secondary driver with email Y. I'm testing X with X later today.

themarch commented 1 week ago

@patrickdemers6 Sorry to delay, it was that ! Thanks a lot