Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #59 #60

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homebridge-ui/public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -509,4 +509,4 @@ $('#removeCar').on('click', async () => {

}

});
});
10 changes: 5 additions & 5 deletions homebridge-ui/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions src/helper/me.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
};

Expand Down Expand Up @@ -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);
Expand Down