edent / BMW-i-Remote

A reverse engineered interface for the BMW i3 Electric Car
MIT License
388 stars 60 forks source link

anyone else getting HTTP 400/401 when retrieving token? #45

Open rs38 opened 5 years ago

rs38 commented 5 years ago

POSTing to https://b2vapi.bmwgroup.com/webapi/oauth/token/ with secret, key, user + password returns bad request, since ~10 days. I'm pretty sure, I did not change anything else.

rs38 commented 5 years ago

some details from fiddler:

HTTP/1.1 400 Bad Request
Date: Sun****
Server: BMW Group API Gateway
X-NodeID: 03
X-Powered-By: JOY
Content-Type: application/json
Connection: close
Content-Length: 83
{
  "error" : "invalid_grant",
  "error_description" : "the authN circuit failed"
}
rs38 commented 5 years ago

thanks to Google and this nice Github Project: https://github.com/m1n3rva/bimmer_connected the URL has changed at least for europe customers:

b2vapi.bmwgroup.com/gcdm/oauth/token/

rs38 commented 5 years ago

for those of you who hardcoded the expiry time of the token to 8h: it's only 1h with the new gcdm OAuth

rs38 commented 5 years ago

my CD implementation is done with .NET/c#. So I cannot test python… I test from europe. Changing paths was only needed for OAuth, not for further requests.

HeraldCoupe commented 4 years ago

my CD implementation is done with .NET/c#. So I cannot test python… I test from europe. Changing paths was only needed for OAuth, not for further requests.

Would you be willing to share your ConnectedDrive .NET/c# code as I'm struggling to get anywhere. I'd really appreciate it.

rs38 commented 4 years ago

it's quick and dirty, but I would share at least the core of course. will let you know, when it's in a repo here. give me a few days, okay?

HeraldCoupe commented 4 years ago

That would be amazing. Thanks so much.

rs38 commented 4 years ago

@HeraldCoupe I commited the core c# methods in my fork. of course I left out some key, secrets, specific stuff, which is also missing in the python code. you need to get it from a BMW CD app image e.g.

https://github.com/rs38/BMW-i-Remote

HeraldCoupe commented 4 years ago

Thanks. I’ve not been able to get the key and secret stuff so far unfortunately. Without that I can’t go any further. 😢

rs38 commented 4 years ago

I think there are at least 2 ways to get the token from BMW. one is like the app (IOS+Android) with secret and key and the other is like a browser with the portal. Both can be found by sniffing your network traffic, googling or have a look in a Android .apk and search for it. This is quite easy.

rs38 commented 4 years ago

@HeraldCoupe I just updated my .NET port and added a hint for the "secret" stuff (as it can be found in any CD repo) https://github.com/rs38/BMW-i-Remote/tree/master/csharp (latest commit)

vslee commented 4 years ago

@rs38 would you like to break out your .NET port into a separate (independent) repo, so that others can follow/star it and submit PRs?

rs38 commented 4 years ago

@vslee okay: https://github.com/rs38/CD-Sharp unlike the pute code in my fork it's now more complete but does not compile as .NET Core migration in progress.