diff --git a/homebridge-ui/public/js/main.js b/homebridge-ui/public/js/main.js index 245334c..25f528f 100644 --- a/homebridge-ui/public/js/main.js +++ b/homebridge-ui/public/js/main.js @@ -398,7 +398,7 @@ $('#startAuth').on('click', async () => { const pollTimer = window.setInterval(function() { if(win.document.URL.includes('?code=')){ window.clearInterval(pollTimer); - GLOBAL.carOptions.autherization_code = win.document.URL.split('?code=')[1]; + GLOBAL.carOptions.autherization_code = win.document.URL.split('?code=')[1].split('&')[0]; $('#authCode').val(GLOBAL.carOptions.autherization_code); win.close(); homebridge.hideSpinner(); @@ -509,4 +509,4 @@ $('#removeCar').on('click', async () => { } -}); \ No newline at end of file +}); diff --git a/homebridge-ui/server.js b/homebridge-ui/server.js index 7e0cebf..5300774 100644 --- a/homebridge-ui/server.js +++ b/homebridge-ui/server.js @@ -26,14 +26,14 @@ class UiServer extends HomebridgePluginUiServer { secret: config.clientSecret }, auth: { - tokenHost: 'https://id.mercedes-benz.com', - tokenPath: '/as/token.oauth2', - authorizePath: '/as/authorization.oauth2' + tokenHost: 'https://ssoalpha.dvb.corpinter.net', + tokenPath: '/v1/token', + authorizePath: '/v1/auth' } }; const redirect_uri = config.origin; - const scopes = 'mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive offline_access'; + const scopes = 'openid offline_access mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive'; this.client = new AuthorizationCode(params); @@ -53,7 +53,7 @@ class UiServer extends HomebridgePluginUiServer { const options = { code, redirect_uri: config.origin, - scope: 'mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive offline_access' + scope: 'openid offline_access mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive' }; try { diff --git a/src/helper/me.js b/src/helper/me.js index e03eb68..3b6bc95 100644 --- a/src/helper/me.js +++ b/src/helper/me.js @@ -19,9 +19,9 @@ class MercedesMe { secret: this.accessory.context.config.clientSecret, }, auth: { - tokenHost: 'https://id.mercedes-benz.com', - tokenPath: '/as/token.oauth2', - authorizePath: '/as/authorization.oauth2', + tokenHost: 'https://ssoalpha.dvb.corpinter.net', + tokenPath: '/v1/token', + authorizePath: '/v1/auth' }, }; @@ -61,8 +61,7 @@ class MercedesMe { Logger.info('Access Token expired! Refreshing token...', this.accessory.displayName); const refreshParams = { - scope: - 'mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive offline_access', + scope: 'openid offline_access mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive' }; this._accessToken = await this._accessToken.refresh(refreshParams);