BMW/Mini: fix retrieving vehicles (#3917)
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Publish Github & APT release (push) Has been cancelled

This commit is contained in:
andig 2022-07-22 11:45:51 +02:00 • committed by GitHub
parent 5662d0e55b
commit 4294fe3f0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -29,7 +29,7 @@ type API struct {
func NewAPI(log *util.Logger, brand string, identity oauth2.TokenSource) *API {
v := &API{
Helper: request.NewHelper(log),
xUserAgent: fmt.Sprintf("android(SP1A.210812.016.C1);%s;2.5.2(14945);row", brand),
xUserAgent: fmt.Sprintf("android(SP1A.210812.016.C1);%s;99.0.0(99999);row", brand),
}
// replace client transport with authenticated transport
@ -43,12 +43,11 @@ func NewAPI(log *util.Logger, brand string, identity oauth2.TokenSource) *API {
func (v *API) eadrax() (VehiclesStatusResponse, error) {
var res VehiclesStatusResponse
uri := fmt.Sprintf("%s/eadrax-vcs/v1/vehicles?apptimezone=120&appDateTime=%d", CocoApiURI, time.Now().Unix())
uri := fmt.Sprintf("%s/eadrax-vcs/v1/vehicles?apptimezone=120&appDateTime=%d", CocoApiURI, time.Now().UnixMilli())
req, err := request.New(http.MethodGet, uri, nil, map[string]string{
"Content-Type": request.JSONContent,
"X-User-Agent": v.xUserAgent,
"bmw-units-preferences": "d=KM;v=L",
"Content-Type": request.JSONContent,
"X-User-Agent": v.xUserAgent,
})
if err == nil {
err = v.DoJSON(req, &res)

View file

@ -108,11 +108,12 @@ func (v *Identity) login() (*oauth2.Token, error) {
}
data := url.Values{
"client_id": {"31c357a0-7a1d-4590-aa99-33b97244d048"},
"response_type": {"code"},
"redirect_uri": {RedirectURI},
"state": {"cwU-gIE27j67poy2UcL3KQ"},
"scope": {"authenticate_user vehicle_data remote_services"},
"client_id": {"31c357a0-7a1d-4590-aa99-33b97244d048"},
"response_type": {"code"},
"redirect_uri": {RedirectURI},
"state": {"cwU-gIE27j67poy2UcL3KQ"},
// "scope": {"authenticate_user vehicle_data remote_services"},
"scope": {"openid profile email offline_access smacc vehicle_data perseus dlm svds cesim vsapi remote_services fupo authenticate_user"},
"nonce": {"login_nonce"},
"code_challenge_method": {"S256"},
"code_challenge": {cv.CodeChallengeS256()},