Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Dec 15, 2023
2 parents 80482c4 + a8e7733 commit 0cb152c
Showing 1 changed file with 17 additions and 53 deletions.
70 changes: 17 additions & 53 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,69 +170,33 @@ class Boschindego extends utils.Adapter {
});

// const token = this.cookieJar.getCookiesSync('https://singlekey-id.com/auth/').find((cookie) => cookie.key === 'X-CSRF-FORM-TOKEN');
const userResponse = await this.requestClient({
await this.requestClient({
method: 'post',
maxBodyLength: Infinity,
url: 'https://singlekey-id.com/auth/de-de/login',
url: 'https://singlekey-id.com/auth/api/v1/authentication/login',
headers: {
'content-type': 'application/x-www-form-urlencoded',
accept: '*/*',
'hx-request': 'true',
'sec-fetch-site': 'same-origin',
'hx-boosted': 'true',
'accept-language': 'de-DE,de;q=0.9',
'sec-fetch-mode': 'cors',
origin: 'https://singlekey-id.com',
'user-agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
'sec-fetch-dest': 'empty',
},
params: loginParams,
data: {
'UserIdentifierInput.EmailInput.StringValue': this.config.username,
__RequestVerificationToken: formData['undefined'],
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
RequestVerificationToken: formData['undefined'],
},

data: JSON.stringify({
username: this.config.username,
password: this.config.password,
keepMeSignedIn: true,
returnUrl: loginParams.returnUrl,
}),
})
.then((res) => {
this.log.debug(JSON.stringify(res.data));
return this.extractHidden(res.data);
return res.data;
})
.catch((error) => {
this.log.error('Please check username and password');
this.log.error(error);
error.response && this.log.error(JSON.stringify(error.response.data));
if (error.response) {
this.log.error(JSON.stringify(error.response.data));
}
});
if (!userResponse) {
this.log.error('Could not extract user data');
return;
}
await this.requestClient({
method: 'post',
maxBodyLength: Infinity,
url: 'https://singlekey-id.com/auth/de-de/login/password',
headers: {
'content-type': 'application/x-www-form-urlencoded',
accept: '*/*',
'hx-request': 'true',
'sec-fetch-site': 'same-origin',
'hx-boosted': 'true',
'accept-language': 'de-DE,de;q=0.9',
'sec-fetch-mode': 'cors',
origin: 'https://singlekey-id.com',
'user-agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
'sec-fetch-dest': 'empty',
},
params: loginParams,
data: {
Password: this.config.password,
RememberMe: 'true',
__RequestVerificationToken: userResponse['undefined'],
},
}).catch((error) => {
this.log.error(error);
error.response && this.log.error(JSON.stringify(error.response.data));
});

const htmlForm = await this.requestClient({
method: 'get',
url: 'https://singlekey-id.com' + loginParams.returnUrl,
Expand Down

0 comments on commit 0cb152c

Please sign in to comment.