mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[mercedesme] New API Migration (#13670)
* adjust servers and scope * ensure IPv4 address for callback Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
This commit is contained in:
parent
bf804ce42c
commit
51f1c0978b
@ -48,8 +48,8 @@ public class Constants {
|
||||
public static final String GROUP_LOCATION = "location";
|
||||
public static final String GROUP_IMAGE = "image";
|
||||
|
||||
public static final String MB_AUTH_URL = "https://id.mercedes-benz.com/as/authorization.oauth2";
|
||||
public static final String MB_TOKEN_URL = "https://id.mercedes-benz.com/as/token.oauth2";
|
||||
public static final String MB_AUTH_URL = "https://ssoalpha.dvb.corpinter.net/v1/auth";
|
||||
public static final String MB_TOKEN_URL = "https://ssoalpha.dvb.corpinter.net/v1/token";
|
||||
public static final String CALLBACK_ENDPOINT = "/mb-callback";
|
||||
public static final String OAUTH_CLIENT_NAME = "#byocar";
|
||||
|
||||
@ -64,6 +64,7 @@ public class Constants {
|
||||
// https://developer.mercedes-benz.com/products/vehicle_status/docs
|
||||
public static final String SCOPE_STATUS = "mb:vehicle:mbdata:vehiclestatus";
|
||||
public static final String SCOPE_OFFLINE = "offline_access";
|
||||
public static final String SCOPE_OPENID = "openid";
|
||||
|
||||
public static final String BASE_URL = "https://api.mercedes-benz.com/vehicledata/v2";
|
||||
public static final String ODO_URL = BASE_URL + "/vehicles/%s/containers/payasyoudrive";
|
||||
|
@ -40,7 +40,7 @@ public class AccountConfiguration {
|
||||
// https://developer.mercedes-benz.com/products/electric_vehicle_status/docs#_required_scopes
|
||||
public String getScope() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(SCOPE_OFFLINE);
|
||||
sb.append(SCOPE_OPENID).append(SPACE).append(SCOPE_OFFLINE);
|
||||
if (odoScope) {
|
||||
sb.append(SPACE).append(SCOPE_ODO);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static String getCallbackIP() throws SocketException {
|
||||
// https://stackoverflow.com/questions/901755/how-to-get-the-ip-of-the-computer-on-linux-through-java
|
||||
// https://stackoverflow.com/questions/1062041/ip-address-not-obtained-in-java
|
||||
for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces
|
||||
.hasMoreElements();) {
|
||||
|
@ -36,7 +36,7 @@ class ConfigurationTest {
|
||||
void testScope() {
|
||||
AccountConfiguration ac = new AccountConfiguration();
|
||||
assertEquals(
|
||||
"offline_access mb:vehicle:mbdata:payasyoudrive mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus",
|
||||
"openid offline_access mb:vehicle:mbdata:payasyoudrive mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus",
|
||||
ac.getScope());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user