cidaas-javascript-sdk 2.0.9 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +6 -0
- package/README.md +49 -0
- package/package.json +10 -10
- package/src/main/web-auth/webauth.js +179 -14
- package/types/main/web-auth/webauth.d.ts +6 -0
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -1818,7 +1818,56 @@ this.cidaas.consentContinue({
|
|
|
1818
1818
|
sub: 'your sub',
|
|
1819
1819
|
});
|
|
1820
1820
|
```
|
|
1821
|
+
##### Accept claim
|
|
1821
1822
|
|
|
1823
|
+
To accept Claim Consent, call ****acceptClaimConsent()****
|
|
1824
|
+
|
|
1825
|
+
##### Sample code
|
|
1826
|
+
```js
|
|
1827
|
+
this.cidaas.acceptClaimConsent({
|
|
1828
|
+
q: 'your sub',
|
|
1829
|
+
client_id: 'your client id',
|
|
1830
|
+
accepted: "accepted claims with array eg: []"
|
|
1831
|
+
}).then((response) => {
|
|
1832
|
+
// type your code here
|
|
1833
|
+
}).catch((err) => {
|
|
1834
|
+
// your failure code here
|
|
1835
|
+
});
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
##### Response
|
|
1839
|
+
```json
|
|
1840
|
+
{
|
|
1841
|
+
"success":true,
|
|
1842
|
+
"status":200,
|
|
1843
|
+
"data": true
|
|
1844
|
+
}
|
|
1845
|
+
```
|
|
1846
|
+
|
|
1847
|
+
##### Revoke claim
|
|
1848
|
+
|
|
1849
|
+
To revoke Claim Consent, call ****revokeClaimConsent()****
|
|
1850
|
+
|
|
1851
|
+
##### Sample code
|
|
1852
|
+
```js
|
|
1853
|
+
this.cidaas.revokeClaimConsent({
|
|
1854
|
+
sub: 'your sub',
|
|
1855
|
+
revoked_claims: "revoked claims with array eg: []"
|
|
1856
|
+
}).then((response) => {
|
|
1857
|
+
// type your code here
|
|
1858
|
+
}).catch((err) => {
|
|
1859
|
+
// your failure code here
|
|
1860
|
+
});
|
|
1861
|
+
```
|
|
1862
|
+
|
|
1863
|
+
##### Response
|
|
1864
|
+
```json
|
|
1865
|
+
{
|
|
1866
|
+
"success":true,
|
|
1867
|
+
"status":200,
|
|
1868
|
+
"data": true
|
|
1869
|
+
}
|
|
1870
|
+
```
|
|
1822
1871
|
#### Deduplication
|
|
1823
1872
|
|
|
1824
1873
|
##### Get deduplication details
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cidaas-javascript-sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"author": "cidaas by Widas ID GmbH",
|
|
5
5
|
"description": "Cidaas native javascript sdk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"build-types": "npx -p typescript tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"crypto-js": "^
|
|
20
|
+
"crypto-js": "^4.1.1",
|
|
21
21
|
"oidc-client": "^1.11.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"compression-webpack-plugin": "^
|
|
25
|
-
"jest": "
|
|
26
|
-
"terser-webpack-plugin": "^5.
|
|
24
|
+
"compression-webpack-plugin": "^9.0.0",
|
|
25
|
+
"jest": "27.3.1",
|
|
26
|
+
"terser-webpack-plugin": "^5.2.4",
|
|
27
27
|
"typescript": "^4.5.4",
|
|
28
|
-
"webpack": "^5.
|
|
29
|
-
"webpack-cli": "^4.
|
|
30
|
-
"webpack-dev-server": "^3.
|
|
31
|
-
"webpack-hot-middleware": "^2.25.
|
|
32
|
-
"webpack-merge": "^5.
|
|
28
|
+
"webpack": "^5.59.1",
|
|
29
|
+
"webpack-cli": "^4.9.1",
|
|
30
|
+
"webpack-dev-server": "^4.3.1",
|
|
31
|
+
"webpack-hot-middleware": "^2.25.1",
|
|
32
|
+
"webpack-merge": "^5.8.0"
|
|
33
33
|
},
|
|
34
34
|
"jest": {
|
|
35
35
|
"collectCoverageFrom": [
|
|
@@ -10,6 +10,7 @@ function WebAuth(settings) {
|
|
|
10
10
|
var usermanager = new Oidc.UserManager(settings);
|
|
11
11
|
window.webAuthSettings = settings;
|
|
12
12
|
window.usermanager = usermanager;
|
|
13
|
+
window.localeSettings = null;
|
|
13
14
|
window.authentication = new Authentication(window.webAuthSettings, window.usermanager);
|
|
14
15
|
window.usermanager.events.addSilentRenewError(function (error) {
|
|
15
16
|
throw new CustomException("Error while renewing silent login", 500);
|
|
@@ -83,9 +84,9 @@ WebAuth.prototype.loginCallback = function () {
|
|
|
83
84
|
} else if (window.webAuthSettings.mode == 'window') {
|
|
84
85
|
window.authentication.popupSignInCallback();
|
|
85
86
|
} else if (window.webAuthSettings.mode == 'silent') {
|
|
86
|
-
window.authentication.silentSignInCallbackV2().then(function(data){
|
|
87
|
+
window.authentication.silentSignInCallbackV2().then(function (data) {
|
|
87
88
|
resolve(data);
|
|
88
|
-
}).catch(function(error){
|
|
89
|
+
}).catch(function (error) {
|
|
89
90
|
reject(error);
|
|
90
91
|
})
|
|
91
92
|
}
|
|
@@ -134,6 +135,9 @@ WebAuth.prototype.getUserProfile = function (options) {
|
|
|
134
135
|
http.open("GET", _serviceURL, true);
|
|
135
136
|
http.setRequestHeader("Content-type", "application/json");
|
|
136
137
|
http.setRequestHeader("access_token", options.access_token);
|
|
138
|
+
if (window.localeSettings) {
|
|
139
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
140
|
+
}
|
|
137
141
|
http.send();
|
|
138
142
|
} catch (ex) {
|
|
139
143
|
reject(ex);
|
|
@@ -158,6 +162,9 @@ WebAuth.prototype.getProfileInfo = function (access_token) {
|
|
|
158
162
|
http.open("GET", _serviceURL, true);
|
|
159
163
|
http.setRequestHeader("Content-type", "application/json");
|
|
160
164
|
http.setRequestHeader("access_token", access_token);
|
|
165
|
+
if (window.localeSettings) {
|
|
166
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
167
|
+
}
|
|
161
168
|
http.send();
|
|
162
169
|
} catch (ex) {
|
|
163
170
|
reject(ex);
|
|
@@ -237,6 +244,9 @@ function createPostPromise(options, serviceurl, errorResolver, access_token) {
|
|
|
237
244
|
if (access_token) {
|
|
238
245
|
http.setRequestHeader("access_token", access_token);
|
|
239
246
|
}
|
|
247
|
+
if (window.localeSettings) {
|
|
248
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
249
|
+
}
|
|
240
250
|
if (options) {
|
|
241
251
|
http.send(JSON.stringify(options));
|
|
242
252
|
} else {
|
|
@@ -265,6 +275,9 @@ WebAuth.prototype.renewToken = function (options) {
|
|
|
265
275
|
};
|
|
266
276
|
http.open("POST", _serviceURL, true);
|
|
267
277
|
http.setRequestHeader("Content-type", "application/json");
|
|
278
|
+
if (window.localeSettings) {
|
|
279
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
280
|
+
}
|
|
268
281
|
http.send(JSON.stringify(options));
|
|
269
282
|
} catch (ex) {
|
|
270
283
|
reject(ex);
|
|
@@ -339,6 +352,9 @@ WebAuth.prototype.getAccessToken = function (options) {
|
|
|
339
352
|
};
|
|
340
353
|
http.open("POST", _serviceURL, true);
|
|
341
354
|
http.setRequestHeader("Content-type", "application/json");
|
|
355
|
+
if (window.localeSettings) {
|
|
356
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
357
|
+
}
|
|
342
358
|
http.send(JSON.stringify(options));
|
|
343
359
|
} catch (ex) {
|
|
344
360
|
reject(ex);
|
|
@@ -362,6 +378,9 @@ WebAuth.prototype.validateAccessToken = function (options) {
|
|
|
362
378
|
};
|
|
363
379
|
http.open("POST", _serviceURL, true);
|
|
364
380
|
http.setRequestHeader("Content-type", "application/json");
|
|
381
|
+
if (window.localeSettings) {
|
|
382
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
383
|
+
}
|
|
365
384
|
http.send(JSON.stringify(options));
|
|
366
385
|
} catch (ex) {
|
|
367
386
|
reject(ex);
|
|
@@ -403,6 +422,9 @@ WebAuth.prototype.getRequestId = function () {
|
|
|
403
422
|
};
|
|
404
423
|
http.open("POST", _serviceURL, true);
|
|
405
424
|
http.setRequestHeader("Content-type", "application/json");
|
|
425
|
+
if (window.localeSettings) {
|
|
426
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
427
|
+
}
|
|
406
428
|
http.send(JSON.stringify(bodyParams));
|
|
407
429
|
} catch (ex) {
|
|
408
430
|
reject(ex);
|
|
@@ -413,21 +435,47 @@ WebAuth.prototype.getRequestId = function () {
|
|
|
413
435
|
// login with username and password
|
|
414
436
|
WebAuth.prototype.loginWithCredentials = function (options) {
|
|
415
437
|
try {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
438
|
+
var form = document.createElement('form');
|
|
439
|
+
form.action = window.webAuthSettings.authority + "/login-srv/login";
|
|
440
|
+
form.method = 'POST';
|
|
441
|
+
for (var key in options) {
|
|
442
|
+
if (options.hasOwnProperty(key)) {
|
|
443
|
+
var hiddenField = document.createElement("input");
|
|
444
|
+
hiddenField.setAttribute("type", "hidden");
|
|
445
|
+
hiddenField.setAttribute("name", key);
|
|
446
|
+
hiddenField.setAttribute("value", options[key]);
|
|
447
|
+
|
|
448
|
+
form.appendChild(hiddenField);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
document.body.appendChild(form);
|
|
452
|
+
form.submit();
|
|
425
453
|
|
|
426
|
-
|
|
454
|
+
} catch (ex) {
|
|
455
|
+
throw new CustomException(ex, 417);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// login with username and password and return response
|
|
460
|
+
WebAuth.prototype.loginWithCredentialsAsynFn = async function (options) {
|
|
461
|
+
try {
|
|
462
|
+
|
|
463
|
+
let formData = new FormData();
|
|
464
|
+
for (let key in options) {
|
|
465
|
+
if (options.hasOwnProperty(key)) {
|
|
466
|
+
formData.append(key, options[key]);
|
|
427
467
|
}
|
|
428
468
|
}
|
|
429
|
-
|
|
430
|
-
|
|
469
|
+
|
|
470
|
+
const response = await fetch(window.webAuthSettings.authority + "/login-srv/login", {
|
|
471
|
+
method: "POST",
|
|
472
|
+
body: formData
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
const actualResponse = await response.json();
|
|
476
|
+
|
|
477
|
+
return actualResponse;
|
|
478
|
+
|
|
431
479
|
} catch (ex) {
|
|
432
480
|
throw new CustomException(ex, 417);
|
|
433
481
|
}
|
|
@@ -476,6 +524,9 @@ WebAuth.prototype.getMissingFields = function (options) {
|
|
|
476
524
|
};
|
|
477
525
|
http.open("GET", _serviceURL, true);
|
|
478
526
|
http.setRequestHeader("Content-type", "application/json");
|
|
527
|
+
if (window.localeSettings) {
|
|
528
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
529
|
+
}
|
|
479
530
|
http.send();
|
|
480
531
|
} catch (ex) {
|
|
481
532
|
reject(ex);
|
|
@@ -500,6 +551,9 @@ WebAuth.prototype.getTenantInfo = function () {
|
|
|
500
551
|
};
|
|
501
552
|
http.open("GET", _serviceURL, true);
|
|
502
553
|
http.setRequestHeader("Content-type", "application/json");
|
|
554
|
+
if (window.localeSettings) {
|
|
555
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
556
|
+
}
|
|
503
557
|
http.send();
|
|
504
558
|
} catch (ex) {
|
|
505
559
|
reject(ex);
|
|
@@ -533,6 +587,9 @@ WebAuth.prototype.getClientInfo = function (options) {
|
|
|
533
587
|
};
|
|
534
588
|
http.open("GET", _serviceURL, true);
|
|
535
589
|
http.setRequestHeader("Content-type", "application/json");
|
|
590
|
+
if (window.localeSettings) {
|
|
591
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
592
|
+
}
|
|
536
593
|
http.send();
|
|
537
594
|
} catch (ex) {
|
|
538
595
|
reject(ex);
|
|
@@ -561,6 +618,9 @@ WebAuth.prototype.getRegistrationSetup = function (options) {
|
|
|
561
618
|
};
|
|
562
619
|
http.open("GET", _serviceURL, true);
|
|
563
620
|
http.setRequestHeader("Content-type", "application/json");
|
|
621
|
+
if (window.localeSettings) {
|
|
622
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
623
|
+
}
|
|
564
624
|
http.send();
|
|
565
625
|
} catch (ex) {
|
|
566
626
|
reject(ex);
|
|
@@ -595,6 +655,8 @@ WebAuth.prototype.register = function (options, headers) {
|
|
|
595
655
|
}
|
|
596
656
|
if (headers.acceptlanguage) {
|
|
597
657
|
http.setRequestHeader("accept-language", headers.acceptlanguage);
|
|
658
|
+
} else if (window.localeSettings) {
|
|
659
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
598
660
|
}
|
|
599
661
|
if (headers.bot_captcha_response) {
|
|
600
662
|
http.setRequestHeader("bot_captcha_response", headers.bot_captcha_response);
|
|
@@ -627,6 +689,9 @@ WebAuth.prototype.getInviteUserDetails = function (options) {
|
|
|
627
689
|
};
|
|
628
690
|
http.open("GET", _serviceURL, true);
|
|
629
691
|
http.setRequestHeader("Content-type", "application/json");
|
|
692
|
+
if (window.localeSettings) {
|
|
693
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
694
|
+
}
|
|
630
695
|
http.send();
|
|
631
696
|
} catch (ex) {
|
|
632
697
|
reject(ex);
|
|
@@ -654,6 +719,9 @@ WebAuth.prototype.getCommunicationStatus = function (options) {
|
|
|
654
719
|
if (options.requestId) {
|
|
655
720
|
http.setRequestHeader("requestId", options.requestId);
|
|
656
721
|
}
|
|
722
|
+
if (window.localeSettings) {
|
|
723
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
724
|
+
}
|
|
657
725
|
http.send();
|
|
658
726
|
} catch (ex) {
|
|
659
727
|
reject(ex);
|
|
@@ -684,6 +752,32 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
|
|
|
684
752
|
}
|
|
685
753
|
};
|
|
686
754
|
|
|
755
|
+
// initiate verification and return response
|
|
756
|
+
WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
|
|
757
|
+
try {
|
|
758
|
+
|
|
759
|
+
let formData = new FormData();
|
|
760
|
+
|
|
761
|
+
for (let key in options) {
|
|
762
|
+
if (options.hasOwnProperty(key)) {
|
|
763
|
+
formData.append(key, options[key]);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const response = await fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
|
|
768
|
+
method: "POST",
|
|
769
|
+
body: formData
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
const actualResponse = await response.json();
|
|
773
|
+
|
|
774
|
+
return actualResponse;
|
|
775
|
+
|
|
776
|
+
} catch (ex) {
|
|
777
|
+
throw new CustomException(ex, 417);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
687
781
|
// verofy account
|
|
688
782
|
WebAuth.prototype.verifyAccount = function (options) {
|
|
689
783
|
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
|
|
@@ -769,6 +863,9 @@ WebAuth.prototype.getMFAList = function (options) {
|
|
|
769
863
|
};
|
|
770
864
|
http.open("GET", _serviceURL, true);
|
|
771
865
|
http.setRequestHeader("Content-type", "application/json");
|
|
866
|
+
if (window.localeSettings) {
|
|
867
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
868
|
+
}
|
|
772
869
|
http.send();
|
|
773
870
|
} catch (ex) {
|
|
774
871
|
reject(ex);
|
|
@@ -1037,6 +1134,9 @@ WebAuth.prototype.getConsentDetails = function (options) {
|
|
|
1037
1134
|
};
|
|
1038
1135
|
http.open("GET", _serviceURL, true);
|
|
1039
1136
|
http.setRequestHeader("Content-type", "application/json");
|
|
1137
|
+
if (window.localeSettings) {
|
|
1138
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1139
|
+
}
|
|
1040
1140
|
http.send();
|
|
1041
1141
|
} catch (ex) {
|
|
1042
1142
|
reject(ex);
|
|
@@ -1078,6 +1178,9 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
|
|
|
1078
1178
|
};
|
|
1079
1179
|
http.open("GET", _serviceURL, true);
|
|
1080
1180
|
http.setRequestHeader("Content-type", "application/json");
|
|
1181
|
+
if (window.localeSettings) {
|
|
1182
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1183
|
+
}
|
|
1081
1184
|
http.send();
|
|
1082
1185
|
} catch (ex) {
|
|
1083
1186
|
reject(ex);
|
|
@@ -1103,6 +1206,9 @@ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
|
|
|
1103
1206
|
http.open("GET", _serviceURL, true);
|
|
1104
1207
|
http.setRequestHeader("Content-type", "application/json");
|
|
1105
1208
|
http.setRequestHeader("Authorization", "Bearer " + options.access_token);
|
|
1209
|
+
if (window.localeSettings) {
|
|
1210
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1211
|
+
}
|
|
1106
1212
|
http.send();
|
|
1107
1213
|
} catch (ex) {
|
|
1108
1214
|
reject(ex);
|
|
@@ -1129,6 +1235,32 @@ WebAuth.prototype.scopeConsentContinue = function (options) {
|
|
|
1129
1235
|
}
|
|
1130
1236
|
};
|
|
1131
1237
|
|
|
1238
|
+
// accept claim Consent
|
|
1239
|
+
WebAuth.prototype.acceptClaimConsent = function (options) {
|
|
1240
|
+
var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/accept";
|
|
1241
|
+
return createPostPromise(options, _serviceURL, false);
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
// claim consent continue login
|
|
1245
|
+
WebAuth.prototype.claimConsentContinue = function (options) {
|
|
1246
|
+
try {
|
|
1247
|
+
var form = document.createElement('form');
|
|
1248
|
+
form.action = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
|
|
1249
|
+
form.method = 'POST';
|
|
1250
|
+
document.body.appendChild(form);
|
|
1251
|
+
form.submit();
|
|
1252
|
+
} catch (ex) {
|
|
1253
|
+
throw new CustomException(ex, 417);
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
// revoke claim Consent
|
|
1258
|
+
WebAuth.prototype.revokeClaimConsent = function (options) {
|
|
1259
|
+
var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/revoke";
|
|
1260
|
+
return createPostPromise(options, _serviceURL, false);
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
|
|
1132
1264
|
// get Deduplication details
|
|
1133
1265
|
WebAuth.prototype.getDeduplicationDetails = function (options) {
|
|
1134
1266
|
return new Promise(function (resolve, reject) {
|
|
@@ -1146,6 +1278,9 @@ WebAuth.prototype.getDeduplicationDetails = function (options) {
|
|
|
1146
1278
|
};
|
|
1147
1279
|
http.open("GET", _serviceURL, true);
|
|
1148
1280
|
http.setRequestHeader("Content-type", "application/json");
|
|
1281
|
+
if (window.localeSettings) {
|
|
1282
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1283
|
+
}
|
|
1149
1284
|
http.send();
|
|
1150
1285
|
} catch (ex) {
|
|
1151
1286
|
reject(ex);
|
|
@@ -1179,6 +1314,9 @@ WebAuth.prototype.registerDeduplication = function (options) {
|
|
|
1179
1314
|
};
|
|
1180
1315
|
http.open("POST", _serviceURL, true);
|
|
1181
1316
|
http.setRequestHeader("Content-type", "application/json");
|
|
1317
|
+
if (window.localeSettings) {
|
|
1318
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1319
|
+
}
|
|
1182
1320
|
http.send();
|
|
1183
1321
|
} catch (ex) {
|
|
1184
1322
|
reject(ex);
|
|
@@ -1281,6 +1419,9 @@ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
|
|
|
1281
1419
|
http.open("PUT", _serviceURL, true);
|
|
1282
1420
|
http.setRequestHeader("Content-type", "application/json");
|
|
1283
1421
|
http.setRequestHeader("access_token", access_token);
|
|
1422
|
+
if (window.localeSettings) {
|
|
1423
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1424
|
+
}
|
|
1284
1425
|
http.send(JSON.stringify(options));
|
|
1285
1426
|
} catch (ex) {
|
|
1286
1427
|
throw new CustomException(ex, 417);
|
|
@@ -1312,6 +1453,9 @@ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
|
|
|
1312
1453
|
http.open("GET", _serviceURL, true);
|
|
1313
1454
|
http.setRequestHeader("Content-type", "application/json");
|
|
1314
1455
|
http.setRequestHeader("access_token", access_token);
|
|
1456
|
+
if (window.localeSettings) {
|
|
1457
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1458
|
+
}
|
|
1315
1459
|
http.send();
|
|
1316
1460
|
} catch (ex) {
|
|
1317
1461
|
throw new CustomException(ex, 417);
|
|
@@ -1337,6 +1481,9 @@ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
|
|
|
1337
1481
|
http.open("GET", _serviceURL, true);
|
|
1338
1482
|
http.setRequestHeader("Content-type", "application/json");
|
|
1339
1483
|
http.setRequestHeader("access_token", access_token);
|
|
1484
|
+
if (window.localeSettings) {
|
|
1485
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1486
|
+
}
|
|
1340
1487
|
http.send();
|
|
1341
1488
|
} catch (ex) {
|
|
1342
1489
|
throw new CustomException(ex, 417);
|
|
@@ -1362,6 +1509,9 @@ WebAuth.prototype.reviewDevice = function (options, access_token, sub) {
|
|
|
1362
1509
|
http.open("PUT", _serviceURL, true);
|
|
1363
1510
|
http.setRequestHeader("Content-type", "application/json");
|
|
1364
1511
|
http.setRequestHeader("access_token", access_token);
|
|
1512
|
+
if (window.localeSettings) {
|
|
1513
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1514
|
+
}
|
|
1365
1515
|
http.send(JSON.stringify(options));
|
|
1366
1516
|
} catch (ex) {
|
|
1367
1517
|
throw new CustomException(ex, 417);
|
|
@@ -1393,6 +1543,9 @@ WebAuth.prototype.viewAcceptedConsent = function (options, access_token) {
|
|
|
1393
1543
|
http.open("GET", _serviceURL, true);
|
|
1394
1544
|
http.setRequestHeader("Content-type", "application/json");
|
|
1395
1545
|
http.setRequestHeader("access_token", access_token);
|
|
1546
|
+
if (window.localeSettings) {
|
|
1547
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1548
|
+
}
|
|
1396
1549
|
http.send();
|
|
1397
1550
|
} catch (ex) {
|
|
1398
1551
|
throw new CustomException(ex, 417);
|
|
@@ -1595,6 +1748,9 @@ WebAuth.prototype.authenticateFaceVerification = function (options) {
|
|
|
1595
1748
|
};
|
|
1596
1749
|
http.open("POST", _serviceURL, true);
|
|
1597
1750
|
http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
|
|
1751
|
+
if (window.localeSettings) {
|
|
1752
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1753
|
+
}
|
|
1598
1754
|
http.send(JSON.stringify(options));
|
|
1599
1755
|
} catch (ex) {
|
|
1600
1756
|
reject(ex);
|
|
@@ -1631,6 +1787,9 @@ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
|
|
|
1631
1787
|
};
|
|
1632
1788
|
http.open("GET", _serviceURL, true);
|
|
1633
1789
|
http.setRequestHeader("Content-type", "application/json");
|
|
1790
|
+
if (window.localeSettings) {
|
|
1791
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1792
|
+
}
|
|
1634
1793
|
http.send();
|
|
1635
1794
|
} catch (ex) {
|
|
1636
1795
|
reject(ex);
|
|
@@ -1659,6 +1818,8 @@ WebAuth.prototype.progressiveRegistration = function (options, headers) {
|
|
|
1659
1818
|
http.setRequestHeader("trackId", headers.trackId);
|
|
1660
1819
|
if (headers.acceptlanguage) {
|
|
1661
1820
|
http.setRequestHeader("accept-language", headers.acceptlanguage);
|
|
1821
|
+
} else if (window.localeSettings) {
|
|
1822
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1662
1823
|
}
|
|
1663
1824
|
http.send(JSON.stringify(options));
|
|
1664
1825
|
} catch (ex) {
|
|
@@ -1695,4 +1856,8 @@ WebAuth.prototype.userCheckExists = function (options) {
|
|
|
1695
1856
|
return createPostPromise(options, _serviceURL, undefined);
|
|
1696
1857
|
};
|
|
1697
1858
|
|
|
1859
|
+
WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
|
|
1860
|
+
window.localeSettings = acceptLanguage;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1698
1863
|
module.exports = WebAuth;
|
|
@@ -20,6 +20,7 @@ declare class WebAuth {
|
|
|
20
20
|
validateAccessToken(options: any): Promise<any>;
|
|
21
21
|
getRequestId(): Promise<any>;
|
|
22
22
|
loginWithCredentials(options: any): void;
|
|
23
|
+
loginWithCredentialsAsynFn(options: any): Promise<any>;
|
|
23
24
|
loginWithSocial(options: any, queryParams: any): void;
|
|
24
25
|
registerWithSocial(options: any, queryParams: any): void;
|
|
25
26
|
getMissingFields(options: any): Promise<any>;
|
|
@@ -31,6 +32,7 @@ declare class WebAuth {
|
|
|
31
32
|
getInviteUserDetails(options: any): Promise<any>;
|
|
32
33
|
getCommunicationStatus(options: any): Promise<any>;
|
|
33
34
|
initiateAccountVerification(options: any): void;
|
|
35
|
+
initiateAccountVerificationAsynFn(options: any): Promise<any>;
|
|
34
36
|
verifyAccount(options: any): Promise<any>;
|
|
35
37
|
initiateResetPassword(options: any): Promise<any>;
|
|
36
38
|
handleResetPassword(options: any): void;
|
|
@@ -79,6 +81,9 @@ declare class WebAuth {
|
|
|
79
81
|
getScopeConsentVersionDetailsV2(options: any): Promise<any>;
|
|
80
82
|
acceptScopeConsent(options: any): Promise<any>;
|
|
81
83
|
scopeConsentContinue(options: any): void;
|
|
84
|
+
acceptClaimConsent(options: any): Promise<any>;
|
|
85
|
+
claimConsentContinue(options: any): void;
|
|
86
|
+
revokeClaimConsent(options: any): Promise<any>;
|
|
82
87
|
getDeduplicationDetails(options: any): Promise<any>;
|
|
83
88
|
deduplicationLogin(options: any): void;
|
|
84
89
|
registerDeduplication(options: any): Promise<any>;
|
|
@@ -127,4 +132,5 @@ declare class WebAuth {
|
|
|
127
132
|
progressiveRegistration(options: any, headers: any): Promise<any>;
|
|
128
133
|
loginAfterRegister(options: any): void;
|
|
129
134
|
userCheckExists(options: any): Promise<any>;
|
|
135
|
+
setAcceptLanguageHeader(acceptLanguage: any): void;
|
|
130
136
|
}
|