2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bmwconnecteddrive.internal.utils;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The {@link BimmerConstants} This class holds the important constants for the BMW Connected Drive Authorization. They
21 * are taken from the Bimmercode from github {@link https://github.com/bimmerconnected/bimmer_connected}
22 * File defining these constants
23 * {@link https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/account.py}
24 * https://customer.bmwgroup.com/one/app/oauth.js
26 * @author Bernd Weymann - Initial contribution
29 public class BimmerConstants {
31 // https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/country_selector.py
32 public static final String REGION_NORTH_AMERICA = "NORTH_AMERICA";
33 public static final String REGION_CHINA = "CHINA";
34 public static final String REGION_ROW = "ROW";
36 // https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/country_selector.py
37 public static final String LEGACY_AUTH_SERVER_NORTH_AMERICA = "login.bmwusa.com/gcdm";
38 public static final String LEGACY_AUTH_SERVER_CHINA = "customer.bmwgroup.cn/gcdm";
39 public static final String LEGACY_AUTH_SERVER_ROW = "customer.bmwgroup.com/gcdm";
40 public static final Map<String, String> LEGACY_AUTH_SERVER_MAP = Map.of(REGION_NORTH_AMERICA,
41 LEGACY_AUTH_SERVER_NORTH_AMERICA, REGION_CHINA, LEGACY_AUTH_SERVER_CHINA, REGION_ROW,
42 LEGACY_AUTH_SERVER_ROW);
44 public static final String OAUTH_ENDPOINT = "/oauth/authenticate";
45 public static final String TOKEN_ENDPOINT = "/oauth/token";
47 public static final String API_SERVER_NORTH_AMERICA = "b2vapi.bmwgroup.us";
48 public static final String API_SERVER_CHINA = "b2vapi.bmwgroup.cn:8592";
49 public static final String API_SERVER_ROW = "b2vapi.bmwgroup.com";
51 public static final String EADRAX_SERVER_NORTH_AMERICA = "cocoapi.bmwgroup.us";
52 public static final String EADRAX_SERVER_ROW = "cocoapi.bmwgroup.com";
53 public static final String EADRAX_SERVER_CHINA = Constants.EMPTY;
54 public static final Map<String, String> EADRAX_SERVER_MAP = Map.of(REGION_NORTH_AMERICA,
55 EADRAX_SERVER_NORTH_AMERICA, REGION_CHINA, EADRAX_SERVER_CHINA, REGION_ROW, EADRAX_SERVER_ROW);
57 public static final Map<String, String> API_SERVER_MAP = Map.of(REGION_NORTH_AMERICA, API_SERVER_NORTH_AMERICA,
58 REGION_CHINA, API_SERVER_CHINA, REGION_ROW, API_SERVER_ROW);
60 // see https://github.com/bimmerconnected/bimmer_connected/pull/252/files
61 public static final Map<String, String> LEGACY_AUTHORIZATION_VALUE_MAP = Map.of(REGION_NORTH_AMERICA,
62 "Basic ZDc2NmI1MzctYTY1NC00Y2JkLWEzZGMtMGNhNTY3MmQ3ZjhkOjE1ZjY5N2Y2LWE1ZDUtNGNhZC05OWQ5LTNhMTViYzdmMzk3Mw==",
64 "Basic blF2NkNxdHhKdVhXUDc0eGYzQ0p3VUVQOjF6REh4NnVuNGNEanliTEVOTjNreWZ1bVgya0VZaWdXUGNRcGR2RFJwSUJrN3JPSg==",
66 "Basic ZDc2NmI1MzctYTY1NC00Y2JkLWEzZGMtMGNhNTY3MmQ3ZjhkOjE1ZjY5N2Y2LWE1ZDUtNGNhZC05OWQ5LTNhMTViYzdmMzk3Mw==");
68 public static final String LEGACY_CREDENTIAL_VALUES = "nQv6CqtxJuXWP74xf3CJwUEP:1zDHx6un4cDjybLENN3kyfumX2kEYigWPcQpdvDRpIBk7rOJ";
69 public static final String LEGACY_REDIRECT_URI_VALUE = "https://www.bmw-connecteddrive.com/app/static/external-dispatch.html";
70 public static final String LEGACY_SCOPE_VALUES = "authenticate_user vehicle_data remote_services";
71 public static final String LEGACY_CLIENT_ID = "dbf0a542-ebd1-4ff0-a9a7-55172fbfce35";
73 public static final String LEGACY_REFERER_URL = "https://www.bmw-connecteddrive.de/app/index.html";
75 public static final String AUTH_SERVER_NORTH_AMERICA = "login.bmwusa.com/gcdm";
76 public static final String AUTH_SERVER_CHINA = "customer.bmwgroup.cn/gcdm";
77 public static final String AUTH_SERVER_ROW = "customer.bmwgroup.com/gcdm";
78 public static final Map<String, String> AUTH_SERVER_MAP = Map.of(REGION_NORTH_AMERICA, AUTH_SERVER_NORTH_AMERICA,
79 REGION_CHINA, AUTH_SERVER_CHINA, REGION_ROW, AUTH_SERVER_ROW);
81 public static final Map<String, String> AUTHORIZATION_VALUE_MAP = Map.of(REGION_NORTH_AMERICA,
82 "Basic NTQzOTRhNGItYjZjMS00NWZlLWI3YjItOGZkM2FhOTI1M2FhOmQ5MmYzMWMwLWY1NzktNDRmNS1hNzdkLTk2NmY4ZjAwZTM1MQ==",
84 "Basic blF2NkNxdHhKdVhXUDc0eGYzQ0p3VUVQOjF6REh4NnVuNGNEanliTEVOTjNreWZ1bVgya0VZaWdXUGNRcGR2RFJwSUJrN3JPSg==",
86 "Basic MzFjMzU3YTAtN2ExZC00NTkwLWFhOTktMzNiOTcyNDRkMDQ4OmMwZTMzOTNkLTcwYTItNGY2Zi05ZDNjLTg1MzBhZjY0ZDU1Mg==");
88 public static final Map<String, String> CODE_VERIFIER = Map.of(REGION_NORTH_AMERICA,
89 "BKDarcVUpgymBDCgHDH0PwwMfzycDxu1joeklioOhwXA", REGION_CHINA, Constants.EMPTY, REGION_ROW,
90 "7PsmfPS5MpaNt0jEcPpi-B7M7u0gs1Nzw6ex0Y9pa-0");
92 public static final Map<String, String> CLIENT_ID = Map.of(REGION_NORTH_AMERICA,
93 "54394a4b-b6c1-45fe-b7b2-8fd3aa9253aa", REGION_CHINA, Constants.EMPTY, REGION_ROW,
94 "31c357a0-7a1d-4590-aa99-33b97244d048");
96 public static final Map<String, String> STATE = Map.of(REGION_NORTH_AMERICA, "rgastJbZsMtup49-Lp0FMQ", REGION_CHINA,
97 Constants.EMPTY, REGION_ROW, "cEG9eLAIi6Nv-aaCAniziE_B6FPoobva3qr5gukilYw");
99 public static final String REDIRECT_URI_VALUE = "com.bmw.connected://oauth";
100 public static final String SCOPE_VALUES = "openid profile email offline_access smacc vehicle_data perseus dlm svds cesim vsapi remote_services fupo authenticate_user";