cidaas-javascript-sdk 2.2.7 → 2.4.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/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
- ## [2.2.7](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v2.2.6...v2.2.7) (2023-02-06)
1
+ # [2.4.0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v2.3.0...v2.4.0) (2023-03-23)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **[gitlab-240](https://gitlab.widas.de/cidaas-v2/auth/issues/-/issues/240):** added cookie for device_dr ([bb50022](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/bb5002253e36fdccd1052bba746e2efbcd031a07))
6
+ * add username and email ([eefaa29](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/eefaa296b685be80f10b6a12f4ed0fc99d380cf4))
7
+ * Added few changes to readme file. ([ef38f00](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/ef38f00e9a734abe77e0553cb528f8836cd4085e))
8
+ * added new api in webauth.ts file ([d5f650d](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/d5f650dcc1f0ce93ef0c0adc81c0d78e4769b556))
9
+ * added the options for max_age parameter ([f1bb8a2](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/f1bb8a2a9e306b4515160b42786d9a5f401e091c))
10
+ * added the options for max_age parameters in SDK method ([209ce9e](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/209ce9e278319f026d1d3da3195341abe407f5fe))
11
+ * github sync ([b12d785](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/b12d7857c5d05972340ce27d4ceae72a0b9c0f90))
12
+ * option error ([3c79e1d](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/3c79e1d44d71a902d9b3209e13e0a16d4c31071a))
13
+ * option error fixed ([1724345](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/1724345045f11c8bedabebbdf433447baf08a8b5))
14
+ * push only master to github ([5ddb5b5](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/5ddb5b5408838468ff38bc649777d6d41fcc7e41))
15
+ * read me file update for account link ([1f62e22](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/1f62e22f40f3808aaa6566d404f2b5950616c8d7))
16
+ * remove manual trigger ([80391c1](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/80391c135b19d15c86012899c784edf664e58fe5))
17
+ * skip remote add if exists ([9080176](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/908017679774080c58e77f073c1c8fecd31d7de1))
18
+ * sync branch changes ([2ae6213](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/2ae621374c29de663ecfc295610c54f03445e6c6))
19
+ * vulnerability fix ([444adb5](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/444adb5249c45e0782d5fb2280a60c5518064a85))
20
+
21
+
22
+ ### Features
23
+
24
+ * added useraccountLink api for two users and update the readme file ([3eea712](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/3eea7123c435bda2ea59ea5bfff1b0481d204940))
package/README.md CHANGED
@@ -83,7 +83,7 @@ To complete the login process, call ****logincallback()****. This will parses th
83
83
 
84
84
  ```js
85
85
  cidaas.loginCallback().then(function(response) {
86
- // your success code here
86
+ // the response will give you login details.
87
87
  }).catch(function(ex) {
88
88
  // your failure code here
89
89
  });
@@ -103,7 +103,7 @@ cidaas.registerWithBrowser();
103
103
  To get the user profile information, call ****getUserInfo()****. This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
104
104
  ```js
105
105
  cidaas.getUserInfo().then(function (response) {
106
- // your success code here
106
+ // the response will give you profile details.
107
107
  }).catch(function(ex) {
108
108
  // your failure code here
109
109
  });;
@@ -114,7 +114,7 @@ cidaas.getUserInfo().then(function (response) {
114
114
 
115
115
  ```js
116
116
  cidaas.logout().then(function () {
117
- // your success code here
117
+ // your logout success code here
118
118
  }).catch(function(ex) {
119
119
  // your failure code here
120
120
  });
@@ -136,7 +136,7 @@ Each and every proccesses starts with requestId, it is an entry point to login o
136
136
 
137
137
  ```js
138
138
  cidaas.getRequestId().then(function (response) {
139
- // your success code here
139
+ // the response will give you request ID.
140
140
  }).catch(function(ex) {
141
141
  // your failure code here
142
142
  });
@@ -163,7 +163,7 @@ To get the tenant basic information, call ****getTenantInfo()****. This will ret
163
163
  ##### Sample code
164
164
  ```js
165
165
  cidaas.getTenantInfo().then(function (response) {
166
- // your success code here
166
+ // the response will give you tenent details.
167
167
  }).catch(function(ex) {
168
168
  // your failure code here
169
169
  });
@@ -193,9 +193,10 @@ To get the client basic information, call ****getClientInfo()****. This will ret
193
193
  ##### Sample code
194
194
  ```js
195
195
  cidaas.getClientInfo({
196
- requestId: 'your requestId'
196
+ requestId: 'your requestId',
197
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
197
198
  }).then(function (resp) {
198
- // your success code here
199
+ // the response will give you client info.
199
200
  }).catch(function(ex) {
200
201
  // your failure code here
201
202
  });
@@ -255,9 +256,9 @@ To handle registration, first you need the registration fields. To get the regis
255
256
  ```js
256
257
  cidaas.getRegistrationSetup({
257
258
  requestId: 'your requestId',
258
- acceptlanguage: 'your locale' // de-de, en-US
259
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
259
260
  }).then(function (resp) {
260
- // your success code here
261
+ // the response will give you fields that are required.
261
262
  }).catch(function(ex) {
262
263
  // your failure code here
263
264
  });
@@ -361,9 +362,10 @@ cidaas.register({
361
362
  family_name: 'yyyyy',
362
363
  password: '123456',
363
364
  password_echo: '123456',
364
- provider: 'your provider' // FACEBOOK, GOOGLE, SELF
365
+ provider: 'your provider', // FACEBOOK, GOOGLE, SELF
366
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
365
367
  }, headers).then(function (response) {
366
- // type your code here
368
+ // the response will give you client registration details.
367
369
  }).catch(function(ex) {
368
370
  // your failure code here
369
371
  });
@@ -412,9 +414,10 @@ Once social register, it will redirect to the extra information page with reques
412
414
  ```js
413
415
  cidaas.getMissingFields({
414
416
  trackId: 'your trackId', // which you will get it from url
415
- requestId: 'your requestId' // which you will get it from url
417
+ requestId: 'your requestId', // which you will get it from url
418
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
416
419
  }).then(function (response) {
417
- // type your code here
420
+ // the response will give you user info with missing fields.
418
421
  }).catch(function (ex) {
419
422
  // your failure code here
420
423
  });
@@ -430,9 +433,10 @@ Once registration successful, verify the account based on the flow. To get the d
430
433
 
431
434
  ```js
432
435
  cidaas.getCommunicationStatus({
433
- sub: 'your sub' // which you will get on the registration response
436
+ sub: 'your sub', // which you will get on the registration response
437
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
434
438
  }).then(function (response) {
435
- // type your code here
439
+ // the response will give you account details once its verified.
436
440
  }).catch(function(ex) {
437
441
  // your failure code here
438
442
  });
@@ -463,7 +467,7 @@ cidaas.initiateAccountVerification({
463
467
  processingType: 'CODE',
464
468
  sub: 'your sub'
465
469
  }).then(function (response) {
466
- // type your code here
470
+ // the response will give you account verification details.
467
471
  }).catch(function(ex) {
468
472
  // your failure code here
469
473
  });
@@ -490,7 +494,7 @@ cidaas.verifyAccount({
490
494
  accvid: 'your accvid', // which you will get on initiate account verification response
491
495
  code: 'your code in email or sms or ivr'
492
496
  }).then(function (response) {
493
- // type your code here
497
+ // the response will give you account verification ID and unique code.
494
498
  }).catch(function(ex) {
495
499
  // your failure code here
496
500
  });
@@ -511,7 +515,7 @@ cidaas.initiateResetPassword({
511
515
  requestId: 'your requestId',
512
516
  resetMedium: 'email'
513
517
  }).then(function (response) {
514
- // type your code here
518
+ // the response will give you password reset details.
515
519
  }).catch(function(ex) {
516
520
  // your failure code here
517
521
  });
@@ -539,7 +543,7 @@ cidaas.handleResetPassword({
539
543
  code: 'your code in email or sms or ivr',
540
544
  resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
541
545
  }).then(function (response) {
542
- // type your code here
546
+ // the response will give you valid verification code.
543
547
  }).catch(function(ex) {
544
548
  // your failure code here
545
549
  });
@@ -569,7 +573,7 @@ cidaas.resetPassword({
569
573
  exchangeId: 'your exchangeId', // which you will get on handle reset password response
570
574
  resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
571
575
  }).then(function (response) {
572
- // type your code here
576
+ // the response will give you reset password details.
573
577
  }).catch(function(ex) {
574
578
  // your failure code here
575
579
  });
@@ -599,7 +603,7 @@ cidaas.changePassword({
599
603
  identityId: 'asdauet1-quwyteuqqwejh-asdjhasd',
600
604
  }, 'your access token')
601
605
  .then(function () {
602
- // type your code here
606
+ // the response will give you changed password.
603
607
  }).catch(function (ex) {
604
608
  // your failure code here
605
609
  });
@@ -624,9 +628,10 @@ To get user profile details, pass access token to ****getProfileInfo()****.
624
628
 
625
629
  ```js
626
630
  cidaas.getProfileInfo({
627
- access_token: 'your access token'
631
+ access_token: 'your access token',
632
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
628
633
  }).then(function (response) {
629
- // type your code here
634
+ // the response will give you user profile details.
630
635
  }).catch(function (ex) {
631
636
  // your failure code here
632
637
  });
@@ -698,9 +703,10 @@ To get the user profile information, call ****getUserProfile()****.
698
703
  ##### Sample code
699
704
  ```js
700
705
  cidaas.getUserProfile({
701
- access_token: 'your access token'
706
+ access_token: 'your access token',
707
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
702
708
  }).then(function (response) {
703
- // type your code here
709
+ // the response will give you user profile information.
704
710
  }).catch(function (ex) {
705
711
  // your failure code here
706
712
  });
@@ -733,9 +739,10 @@ To update the user profile information, call ****updateProfile()****.
733
739
  cidaas.updateProfile({
734
740
  family_name: 'Doe',
735
741
  given_name: 'John',
736
- provider: 'self'
742
+ provider: 'self',
743
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
737
744
  }, 'your access token', 'your sub').then(function () {
738
- // type your code here
745
+ // the response will give you updated user profile info.
739
746
  }).catch(function (ex) {
740
747
  // your failure code here
741
748
  });
@@ -780,7 +787,7 @@ The usage of the method is as follows.
780
787
  ```js
781
788
  cidaas.deleteUserAccount(options).then(function (response) {
782
789
 
783
- // your success code here
790
+ // the response will give you account details to be deleted.
784
791
 
785
792
  }).catch(function(ex) {
786
793
 
@@ -816,7 +823,7 @@ this.cidaas.setupEmail({
816
823
  deviceId: 'your device id'
817
824
  }
818
825
  }).then((response) => {
819
- // type your code here
826
+ // the response will give you details for email setup.
820
827
  }).catch((err) => {
821
828
  // your failure code here
822
829
  });
@@ -846,7 +853,7 @@ this.cidaas.enrollEmail({
846
853
  deviceId: 'your device id'
847
854
  }
848
855
  }).then((response) => {
849
- // type your code here
856
+ // the response will give you email and device info to be linked.
850
857
  }).catch((err) => {
851
858
  // your failure code here
852
859
  });
@@ -879,7 +886,7 @@ this.cidaas.initiateEmail({
879
886
  deviceId: 'your device id'
880
887
  }
881
888
  }).then((response) => {
882
- // type your code here
889
+ // the response will give you email verification code details.
883
890
  }).catch((err) => {
884
891
  // your failure code here
885
892
  });
@@ -911,7 +918,7 @@ this.cidaas.authenticateEmail({
911
918
  deviceId: 'your device id'
912
919
  }
913
920
  }).then((response) => {
914
- // type your code here
921
+ // the response will give you email authentication details.
915
922
  }).catch((err) => {
916
923
  // your failure code here
917
924
  });
@@ -941,7 +948,7 @@ this.cidaas.setupSMS({
941
948
  deviceId: 'your device id'
942
949
  }
943
950
  }).then((response) => {
944
- // type your code here
951
+ // the response will give you details for SMS setup.
945
952
  }).catch((err) => {
946
953
  // your failure code here
947
954
  });
@@ -971,7 +978,7 @@ this.cidaas.enrollSMS({
971
978
  deviceId: 'your device id'
972
979
  }
973
980
  }).then((response) => {
974
- // type your code here
981
+ // the response will give you SMS and device info to be linked
975
982
  }).catch((err) => {
976
983
  // your failure code here
977
984
  });
@@ -1004,7 +1011,7 @@ this.cidaas.initiateSMS({
1004
1011
  deviceId: 'your device id'
1005
1012
  }
1006
1013
  }).then((response) => {
1007
- // type your code here
1014
+ // the response will give you SMS verification code details.
1008
1015
  }).catch((err) => {
1009
1016
  // your failure code here
1010
1017
  });
@@ -1036,7 +1043,7 @@ this.cidaas.authenticateSMS({
1036
1043
  deviceId: 'your device id'
1037
1044
  }
1038
1045
  }).then((response) => {
1039
- // type your code here
1046
+ // the response will give you SMS authentiction details.
1040
1047
  }).catch((err) => {
1041
1048
  // your failure code here
1042
1049
  });
@@ -1066,7 +1073,7 @@ this.cidaas.setupIVR({
1066
1073
  deviceId: 'your device id'
1067
1074
  }
1068
1075
  }).then((response) => {
1069
- // type your code here
1076
+ // the response will give you details for IVR setup.
1070
1077
  }).catch((err) => {
1071
1078
  // your failure code here
1072
1079
  });
@@ -1096,7 +1103,7 @@ this.cidaas.enrollIVR({
1096
1103
  deviceId: 'your device id'
1097
1104
  }
1098
1105
  }).then((response) => {
1099
- // type your code here
1106
+ // the response will give you IVR and device info to be linked.
1100
1107
  }).catch((err) => {
1101
1108
  // your failure code here
1102
1109
  });
@@ -1129,7 +1136,7 @@ this.cidaas.initiateIVR({
1129
1136
  deviceId: 'your device id'
1130
1137
  }
1131
1138
  }).then((response) => {
1132
- // type your code here
1139
+ // the response will give you IVR verification code details.
1133
1140
  }).catch((err) => {
1134
1141
  // your failure code here
1135
1142
  });
@@ -1161,7 +1168,7 @@ this.cidaas.authenticateIVR({
1161
1168
  deviceId: 'your device id'
1162
1169
  }
1163
1170
  }).then((response) => {
1164
- // type your code here
1171
+ // the response will give you IVR authentication details.
1165
1172
  }).catch((err) => {
1166
1173
  // your failure code here
1167
1174
  });
@@ -1191,7 +1198,7 @@ this.cidaas.setupBackupcode({
1191
1198
  deviceId: 'your device id'
1192
1199
  }
1193
1200
  }).then((response) => {
1194
- // type your code here
1201
+ // the response will give you details for backup-code setup.
1195
1202
  }).catch((err) => {
1196
1203
  // your failure code here
1197
1204
  });
@@ -1230,7 +1237,7 @@ this.cidaas.initiateBackupcode({
1230
1237
  deviceId: 'your device id'
1231
1238
  }
1232
1239
  }).then((response) => {
1233
- // type your code here
1240
+ // the response will give you backup-code verification code details.
1234
1241
  }).catch((err) => {
1235
1242
  // your failure code here
1236
1243
  });
@@ -1262,7 +1269,7 @@ this.cidaas.authenticateBackupcode({
1262
1269
  deviceId: 'your device id'
1263
1270
  }
1264
1271
  }).then((response) => {
1265
- // type your code here
1272
+ // the response will give you backup-code authentication details.
1266
1273
  }).catch((err) => {
1267
1274
  // your failure code here
1268
1275
  });
@@ -1293,7 +1300,7 @@ this.cidaas.setupTOTP({
1293
1300
  deviceId: 'your device id'
1294
1301
  }
1295
1302
  }).then((response) => {
1296
- // type your code here
1303
+ // the response will give you details for TOTP setup.
1297
1304
  }).catch((err) => {
1298
1305
  // your failure code here
1299
1306
  });
@@ -1323,7 +1330,7 @@ this.cidaas.enrollTOTP({
1323
1330
  deviceId: 'your device id'
1324
1331
  }
1325
1332
  }).then((response) => {
1326
- // type your code here
1333
+ // the response will give you TOTP and device info to be linked.
1327
1334
  }).catch((err) => {
1328
1335
  // your failure code here
1329
1336
  });
@@ -1356,7 +1363,7 @@ this.cidaas.initiateTOTP({
1356
1363
  deviceId: 'your device id'
1357
1364
  }
1358
1365
  }).then((response) => {
1359
- // type your code here
1366
+ // the response will give you TOTP verification details.
1360
1367
  }).catch((err) => {
1361
1368
  // your failure code here
1362
1369
  });
@@ -1388,7 +1395,7 @@ this.cidaas.authenticateTOTP({
1388
1395
  deviceId: 'your device id'
1389
1396
  }
1390
1397
  }).then((response) => {
1391
- // type your code here
1398
+ // the response will give you TOTP authentication details.
1392
1399
  }).catch((err) => {
1393
1400
  // your failure code here
1394
1401
  });
@@ -1419,7 +1426,7 @@ this.cidaas.setupPattern({
1419
1426
  deviceId: 'your device id'
1420
1427
  }
1421
1428
  }).then((response) => {
1422
- // type your code here
1429
+ // the response will give you details for Pattern setup.
1423
1430
  }).catch((err) => {
1424
1431
  // your failure code here
1425
1432
  });
@@ -1453,7 +1460,7 @@ this.cidaas.initiatePattern({
1453
1460
  deviceId: 'your device id'
1454
1461
  }
1455
1462
  }).then((response) => {
1456
- // type your code here
1463
+ // the response will give you Pattern verification details.
1457
1464
  }).catch((err) => {
1458
1465
  // your failure code here
1459
1466
  });
@@ -1486,7 +1493,7 @@ this.cidaas.setupTouchId({
1486
1493
  deviceId: 'your device id'
1487
1494
  }
1488
1495
  }).then((response) => {
1489
- // type your code here
1496
+ // the response will give you details for Touch ID setup.
1490
1497
  }).catch((err) => {
1491
1498
  // your failure code here
1492
1499
  });
@@ -1520,7 +1527,7 @@ this.cidaas.initiateTouchId({
1520
1527
  deviceId: 'your device id'
1521
1528
  }
1522
1529
  }).then((response) => {
1523
- // type your code here
1530
+ // the response will give you Touch ID verification details.
1524
1531
  }).catch((err) => {
1525
1532
  // your failure code here
1526
1533
  });
@@ -1553,7 +1560,7 @@ this.cidaas.setupSmartPush({
1553
1560
  deviceId: 'your device id'
1554
1561
  }
1555
1562
  }).then((response) => {
1556
- // type your code here
1563
+ // the response will give you details for Smart Push setup.
1557
1564
  }).catch((err) => {
1558
1565
  // your failure code here
1559
1566
  });
@@ -1576,7 +1583,7 @@ this.cidaas.initiateSmartPush({
1576
1583
  deviceId: 'your device id'
1577
1584
  }
1578
1585
  }).then((response) => {
1579
- // type your code here
1586
+ // the response will give you Smart Push verification details.
1580
1587
  }).catch((err) => {
1581
1588
  // your failure code here
1582
1589
  });
@@ -1609,7 +1616,7 @@ this.cidaas.setupFace({
1609
1616
  deviceId: 'your device id'
1610
1617
  }
1611
1618
  }).then((response) => {
1612
- // type your code here
1619
+ // the response will give you details for Face setup.
1613
1620
  }).catch((err) => {
1614
1621
  // your failure code here
1615
1622
  });
@@ -1643,7 +1650,7 @@ this.cidaas.initiateFace({
1643
1650
  deviceId: 'your device id'
1644
1651
  }
1645
1652
  }).then((response) => {
1646
- // type your code here
1653
+ // the response will give you Face verification details.
1647
1654
  }).catch((err) => {
1648
1655
  // your failure code here
1649
1656
  });
@@ -1676,7 +1683,7 @@ this.cidaas.setupVoice({
1676
1683
  deviceId: 'your device id'
1677
1684
  }
1678
1685
  }).then((response) => {
1679
- // type your code here
1686
+ // the response will give you details for Voice setup.
1680
1687
  }).catch((err) => {
1681
1688
  // your failure code here
1682
1689
  });
@@ -1710,7 +1717,7 @@ this.cidaas.initiateVoice({
1710
1717
  deviceId: 'your device id'
1711
1718
  }
1712
1719
  }).then((response) => {
1713
- // type your code here
1720
+ // the response will give you Voice verification details.
1714
1721
  }).catch((err) => {
1715
1722
  // your failure code here
1716
1723
  });
@@ -1755,9 +1762,10 @@ To get the details of consent tile and description, call ****getConsentDetails()
1755
1762
  ##### Sample code
1756
1763
  ```js
1757
1764
  this.cidaas.getConsentDetails({
1758
- consent_name: 'your consent name'
1765
+ consent_name: 'your consent name',
1766
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1759
1767
  }).then((response) => {
1760
- // type your code here
1768
+ // the response will give you details of consent.
1761
1769
  }).catch((err) => {
1762
1770
  // your failure code here
1763
1771
  });
@@ -1788,7 +1796,7 @@ this.cidaas.acceptConsent({
1788
1796
  client_id: 'your client id',
1789
1797
  accepted: true
1790
1798
  }).then((response) => {
1791
- // type your code here
1799
+ // the response will give you details of accepted consent.
1792
1800
  }).catch((err) => {
1793
1801
  // your failure code here
1794
1802
  });
@@ -1830,7 +1838,7 @@ this.cidaas.acceptClaimConsent({
1830
1838
  client_id: 'your client id',
1831
1839
  accepted: "accepted claims with array eg: []"
1832
1840
  }).then((response) => {
1833
- // type your code here
1841
+ // the response will give you accepted claim consent.
1834
1842
  }).catch((err) => {
1835
1843
  // your failure code here
1836
1844
  });
@@ -1855,7 +1863,7 @@ this.cidaas.revokeClaimConsent({
1855
1863
  sub: 'your sub',
1856
1864
  revoked_claims: "revoked claims with array eg: []"
1857
1865
  }).then((response) => {
1858
- // type your code here
1866
+ // the response will give you revoked claim consent.
1859
1867
  }).catch((err) => {
1860
1868
  // your failure code here
1861
1869
  });
@@ -1878,9 +1886,10 @@ To get the list of existing users in deduplication, call ****getDeduplicationDet
1878
1886
  ##### Sample code
1879
1887
  ```js
1880
1888
  this.cidaas.getDeduplicationDetails({
1881
- track_id: 'your track id'
1889
+ track_id: 'your track id',
1890
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1882
1891
  }).then((response) => {
1883
- // type your code here
1892
+ // the response will give you deduplication details of users.
1884
1893
  }).catch((err) => {
1885
1894
  // your failure code here
1886
1895
  });
@@ -1912,9 +1921,10 @@ To register new user in deduplication, call ****registerDeduplication()****.
1912
1921
  ##### Sample code
1913
1922
  ```js
1914
1923
  this.cidaas.registerDeduplication({
1915
- track_id: 'your track id'
1924
+ track_id: 'your track id',
1925
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1916
1926
  }).then((response) => {
1917
- // type your code here
1927
+ // the response will give you new registered deduplication user.
1918
1928
  }).catch((err) => {
1919
1929
  // your failure code here
1920
1930
  });
@@ -1945,7 +1955,7 @@ this.cidaas.deduplicationLogin({
1945
1955
  requestId: 'your request id',
1946
1956
  password: 'your password'
1947
1957
  }).then((response) => {
1948
- // type your code here
1958
+ // the response will give you deduplication login details.
1949
1959
  }).catch((err) => {
1950
1960
  // your failure code here
1951
1961
  });
@@ -1966,6 +1976,40 @@ this.cidaas.deduplicationLogin({
1966
1976
  }
1967
1977
  }
1968
1978
  ```
1979
+
1980
+ ##### Initiate Users Link
1981
+
1982
+ To initiate a new user link, call ****userAccountLink()****.
1983
+
1984
+ ##### Sample code
1985
+
1986
+ ```js
1987
+ var options = {
1988
+ sub: 'sub of the user who initiates the user link',
1989
+ username: 'username of the user which should get linked',
1990
+ redirect_uri: 'redirect uri the user should get redirected after successful account linking'
1991
+ }
1992
+ ```
1993
+
1994
+ ```js
1995
+ this.cidaas.userAccountLink(options, access_token).then((response) => {
1996
+ // the response will give you that both user are linked.
1997
+ }).catch((err) => {
1998
+ // your failure code here
1999
+ });
2000
+ ```
2001
+
2002
+ ##### Response
2003
+ ```json
2004
+ {
2005
+ "success":true,
2006
+ "status":200,
2007
+ "data": {
2008
+ "redirectUri": "string"
2009
+ }
2010
+ }
2011
+ ```
2012
+
1969
2013
  #### Socket Connection
1970
2014
 
1971
2015
  ##### Installation
@@ -2055,4 +2099,12 @@ this.socket.on("status-update", (msg) => {
2055
2099
  }
2056
2100
  });
2057
2101
  ```
2058
- F
2102
+
2103
+ ## Possible Error
2104
+
2105
+ The SDK will throws Custom Exception if something went wrong during the operation:
2106
+
2107
+ | HTTP Status Code | When could it be thrown |
2108
+ |---|---|
2109
+ | 500 | during creation of WebAuth instance |
2110
+ | 417 | if there are any other failure |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.4.0",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "jest": "27.3.1",
38
38
  "terser-webpack-plugin": "^5.2.4",
39
39
  "typescript": "^4.5.4",
40
- "webpack": "^5.59.1",
40
+ "webpack": "^5.76.2",
41
41
  "webpack-cli": "^4.9.1",
42
42
  "webpack-dev-server": "^4.3.1",
43
43
  "webpack-hot-middleware": "^2.25.1",
@@ -2,8 +2,7 @@ var Authentication = require('../authentication');
2
2
  var CustomException = require('./exception');
3
3
  var Oidc = require('oidc-client');
4
4
  var CryptoJS = require("crypto-js");
5
- var fingerprint = require('@fingerprintjs/fingerprintjs')
6
-
5
+ var fingerprint = require('@fingerprintjs/fingerprintjs');
7
6
 
8
7
  var code_verifier;
9
8
 
@@ -24,6 +23,17 @@ function WebAuth(settings) {
24
23
 
25
24
  var registrationFields = [];
26
25
 
26
+ // added the common header
27
+ function createHeaders(http, options) {
28
+ http.setRequestHeader("Content-Type", "application/json");
29
+ if (options && options.acceptlanguage) {
30
+ http.setRequestHeader("Accept-Language", options.acceptlanguage);
31
+ } else if (window.localeSettings) {
32
+ http.setRequestHeader("Accept-Language", window.localeSettings);
33
+ }
34
+ return http;
35
+ }
36
+
27
37
  // prototype methods
28
38
  // login
29
39
  WebAuth.prototype.loginWithBrowser = function () {
@@ -135,11 +145,8 @@ WebAuth.prototype.getUserProfile = function (options) {
135
145
  }
136
146
  };
137
147
  http.open("GET", _serviceURL, true);
138
- http.setRequestHeader("Content-type", "application/json");
148
+ http = createHeaders(http, options);
139
149
  http.setRequestHeader("Authorization", `Bearer ${options.access_token}`);
140
- if (window.localeSettings) {
141
- http.setRequestHeader("accept-language", window.localeSettings);
142
- }
143
150
  http.send();
144
151
  } catch (ex) {
145
152
  reject(ex);
@@ -162,11 +169,8 @@ WebAuth.prototype.getProfileInfo = function (access_token) {
162
169
  }
163
170
  };
164
171
  http.open("GET", _serviceURL, true);
165
- http.setRequestHeader("Content-type", "application/json");
172
+ http = createHeaders(http, null);
166
173
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
167
- if (window.localeSettings) {
168
- http.setRequestHeader("accept-language", window.localeSettings);
169
- }
170
174
  http.send();
171
175
  } catch (ex) {
172
176
  reject(ex);
@@ -246,9 +250,6 @@ function createPostPromise(options, serviceurl, errorResolver, access_token) {
246
250
  if (access_token) {
247
251
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
248
252
  }
249
- if (window.localeSettings) {
250
- http.setRequestHeader("accept-language", window.localeSettings);
251
- }
252
253
  if (options) {
253
254
  http.send(JSON.stringify(options));
254
255
  } else {
@@ -276,10 +277,7 @@ WebAuth.prototype.renewToken = function (options) {
276
277
  }
277
278
  };
278
279
  http.open("POST", _serviceURL, true);
279
- http.setRequestHeader("Content-type", "application/json");
280
- if (window.localeSettings) {
281
- http.setRequestHeader("accept-language", window.localeSettings);
282
- }
280
+ http = createHeaders(http, options);
283
281
  http.send(JSON.stringify(options));
284
282
  } catch (ex) {
285
283
  reject(ex);
@@ -309,7 +307,7 @@ WebAuth.prototype.base64URL = function (string) {
309
307
  };
310
308
 
311
309
  // get login url
312
- WebAuth.prototype.getLoginURL = function () {
310
+ WebAuth.prototype.getLoginURL = function (options = {}) {
313
311
  var settings = window.webAuthSettings;
314
312
  if (!settings.response_type) {
315
313
  settings.response_type = "code";
@@ -330,6 +328,9 @@ WebAuth.prototype.getLoginURL = function () {
330
328
  loginURL += "&response_mode=" + settings.response_mode;
331
329
  }
332
330
  loginURL += "&scope=" + settings.scope;
331
+ if(options && options.max_age){
332
+ loginURL += "&max_age=" + options.max_age;
333
+ }
333
334
  console.log(loginURL);
334
335
  return loginURL;
335
336
  };
@@ -353,10 +354,7 @@ WebAuth.prototype.getAccessToken = function (options) {
353
354
  }
354
355
  };
355
356
  http.open("POST", _serviceURL, true);
356
- http.setRequestHeader("Content-type", "application/json");
357
- if (window.localeSettings) {
358
- http.setRequestHeader("accept-language", window.localeSettings);
359
- }
357
+ http = createHeaders(http, options);
360
358
  http.send(JSON.stringify(options));
361
359
  } catch (ex) {
362
360
  reject(ex);
@@ -379,10 +377,7 @@ WebAuth.prototype.validateAccessToken = function (options) {
379
377
  }
380
378
  };
381
379
  http.open("POST", _serviceURL, true);
382
- http.setRequestHeader("Content-type", "application/json");
383
- if (window.localeSettings) {
384
- http.setRequestHeader("accept-language", window.localeSettings);
385
- }
380
+ http = createHeaders(http, options);
386
381
  http.send(JSON.stringify(options));
387
382
  } catch (ex) {
388
383
  reject(ex);
@@ -423,10 +418,7 @@ WebAuth.prototype.getRequestId = function () {
423
418
  }
424
419
  };
425
420
  http.open("POST", _serviceURL, true);
426
- http.setRequestHeader("Content-type", "application/json");
427
- if (window.localeSettings) {
428
- http.setRequestHeader("accept-language", window.localeSettings);
429
- }
421
+ http = createHeaders(http, null);
430
422
  http.send(JSON.stringify(bodyParams));
431
423
  } catch (ex) {
432
424
  reject(ex);
@@ -522,10 +514,7 @@ WebAuth.prototype.getMissingFields = function (options) {
522
514
  }
523
515
  };
524
516
  http.open("GET", _serviceURL, true);
525
- http.setRequestHeader("Content-type", "application/json");
526
- if (window.localeSettings) {
527
- http.setRequestHeader("accept-language", window.localeSettings);
528
- }
517
+ http = createHeaders(http, options);
529
518
  http.send();
530
519
  } catch (ex) {
531
520
  reject(ex);
@@ -549,10 +538,7 @@ WebAuth.prototype.getTenantInfo = function () {
549
538
  }
550
539
  };
551
540
  http.open("GET", _serviceURL, true);
552
- http.setRequestHeader("Content-type", "application/json");
553
- if (window.localeSettings) {
554
- http.setRequestHeader("accept-language", window.localeSettings);
555
- }
541
+ http = createHeaders(http, null);
556
542
  http.send();
557
543
  } catch (ex) {
558
544
  reject(ex);
@@ -585,10 +571,7 @@ WebAuth.prototype.getClientInfo = function (options) {
585
571
  }
586
572
  };
587
573
  http.open("GET", _serviceURL, true);
588
- http.setRequestHeader("Content-type", "application/json");
589
- if (window.localeSettings) {
590
- http.setRequestHeader("accept-language", window.localeSettings);
591
- }
574
+ http = createHeaders(http, options);
592
575
  http.send();
593
576
  } catch (ex) {
594
577
  reject(ex);
@@ -612,11 +595,8 @@ WebAuth.prototype.getDevicesInfo = function (options) {
612
595
  }
613
596
  };
614
597
  http.open("GET", _serviceURL, true);
615
- http.setRequestHeader("Content-type", "application/json");
616
- if (window.localeSettings) {
617
- http.setRequestHeader("accept-language", window.localeSettings);
618
- }
619
- if(window.navigator.userAgent) {
598
+ http = createHeaders(http, options);
599
+ if (window.navigator.userAgent) {
620
600
  http.setRequestBody("userAgent", window.navigator.userAgent)
621
601
  }
622
602
  http.send();
@@ -642,11 +622,8 @@ WebAuth.prototype.deleteDevice = function (options) {
642
622
  }
643
623
  };
644
624
  http.open("DELETE", _serviceURL, true);
645
- http.setRequestHeader("Content-type", "application/json");
646
- if (window.localeSettings) {
647
- http.setRequestHeader("accept-language", window.localeSettings);
648
- }
649
- if(window.navigator.userAgent) {
625
+ http = createHeaders(http, options);
626
+ if (window.navigator.userAgent) {
650
627
  http.setRequestBody("userAgent", window.navigator.userAgent)
651
628
  }
652
629
  http.send();
@@ -676,10 +653,7 @@ WebAuth.prototype.getRegistrationSetup = function (options) {
676
653
  }
677
654
  };
678
655
  http.open("GET", _serviceURL, true);
679
- http.setRequestHeader("Content-type", "application/json");
680
- if (window.localeSettings) {
681
- http.setRequestHeader("accept-language", window.localeSettings);
682
- }
656
+ http = createHeaders(http, options);
683
657
  http.send();
684
658
  } catch (ex) {
685
659
  reject(ex);
@@ -707,16 +681,11 @@ WebAuth.prototype.register = function (options, headers) {
707
681
  }
708
682
  };
709
683
  http.open("POST", _serviceURL, true);
710
- http.setRequestHeader("Content-type", "application/json");
684
+ http = createHeaders(http, options);
711
685
  http.setRequestHeader("requestId", headers.requestId);
712
686
  if (headers.captcha) {
713
687
  http.setRequestHeader("captcha", headers.captcha);
714
688
  }
715
- if (headers.acceptlanguage) {
716
- http.setRequestHeader("accept-language", headers.acceptlanguage);
717
- } else if (window.localeSettings) {
718
- http.setRequestHeader("accept-language", window.localeSettings);
719
- }
720
689
  if (headers.bot_captcha_response) {
721
690
  http.setRequestHeader("bot_captcha_response", headers.bot_captcha_response);
722
691
  }
@@ -747,10 +716,7 @@ WebAuth.prototype.getInviteUserDetails = function (options) {
747
716
  }
748
717
  };
749
718
  http.open("GET", _serviceURL, true);
750
- http.setRequestHeader("Content-type", "application/json");
751
- if (window.localeSettings) {
752
- http.setRequestHeader("accept-language", window.localeSettings);
753
- }
719
+ http = createHeaders(http, options);
754
720
  http.send();
755
721
  } catch (ex) {
756
722
  reject(ex);
@@ -774,13 +740,10 @@ WebAuth.prototype.getCommunicationStatus = function (options) {
774
740
  }
775
741
  };
776
742
  http.open("GET", _serviceURL, true);
777
- http.setRequestHeader("Content-type", "application/json");
743
+ http = createHeaders(http, options);
778
744
  if (options.requestId) {
779
745
  http.setRequestHeader("requestId", options.requestId);
780
746
  }
781
- if (window.localeSettings) {
782
- http.setRequestHeader("accept-language", window.localeSettings);
783
- }
784
747
  http.send();
785
748
  } catch (ex) {
786
749
  reject(ex);
@@ -813,7 +776,7 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
813
776
 
814
777
  // initiate verification and return response
815
778
  WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
816
- try {
779
+ try {
817
780
 
818
781
  const searchParams = new URLSearchParams(options);
819
782
 
@@ -830,8 +793,8 @@ WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
830
793
 
831
794
  } catch (ex) {
832
795
  throw new CustomException(ex, 417);
833
- }
834
-
796
+ }
797
+
835
798
  };
836
799
 
837
800
  // verofy account
@@ -918,10 +881,7 @@ WebAuth.prototype.getMFAList = function (options) {
918
881
  }
919
882
  };
920
883
  http.open("GET", _serviceURL, true);
921
- http.setRequestHeader("Content-type", "application/json");
922
- if (window.localeSettings) {
923
- http.setRequestHeader("accept-language", window.localeSettings);
924
- }
884
+ http = createHeaders(http, options);
925
885
  http.send();
926
886
  } catch (ex) {
927
887
  reject(ex);
@@ -940,7 +900,7 @@ WebAuth.prototype.getMFAListV2 = function (options) {
940
900
  // initiate mfa v2
941
901
  WebAuth.prototype.initiateMFAV2 = function (options) {
942
902
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
943
- return createPostPromise(options, _serviceURL, undefined);
903
+ return createPostPromise(options, _serviceURL, false);
944
904
  };
945
905
 
946
906
  // initiate email
@@ -953,7 +913,7 @@ WebAuth.prototype.initiateEmail = function (options) {
953
913
  // initiate email v2
954
914
  WebAuth.prototype.initiateEmailV2 = function (options) {
955
915
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/email";
956
- return createPostPromise(options, _serviceURL, undefined);
916
+ return createPostPromise(options, _serviceURL, false);
957
917
  };
958
918
 
959
919
  // initiate sms
@@ -966,7 +926,7 @@ WebAuth.prototype.initiateSMS = function (options) {
966
926
  // initiate sms v2
967
927
  WebAuth.prototype.initiateSMSV2 = function (options) {
968
928
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/sms";
969
- return createPostPromise(options, _serviceURL, undefined);
929
+ return createPostPromise(options, _serviceURL, false);
970
930
  };
971
931
 
972
932
  // initiate ivr
@@ -1189,10 +1149,7 @@ WebAuth.prototype.getConsentDetails = function (options) {
1189
1149
  }
1190
1150
  };
1191
1151
  http.open("GET", _serviceURL, true);
1192
- http.setRequestHeader("Content-type", "application/json");
1193
- if (window.localeSettings) {
1194
- http.setRequestHeader("accept-language", window.localeSettings);
1195
- }
1152
+ http = createHeaders(http, options);
1196
1153
  http.send();
1197
1154
  } catch (ex) {
1198
1155
  reject(ex);
@@ -1233,10 +1190,7 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
1233
1190
  }
1234
1191
  };
1235
1192
  http.open("GET", _serviceURL, true);
1236
- http.setRequestHeader("Content-type", "application/json");
1237
- if (window.localeSettings) {
1238
- http.setRequestHeader("accept-language", window.localeSettings);
1239
- }
1193
+ http = createHeaders(http, options);
1240
1194
  http.send();
1241
1195
  } catch (ex) {
1242
1196
  reject(ex);
@@ -1260,11 +1214,8 @@ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
1260
1214
  }
1261
1215
  };
1262
1216
  http.open("GET", _serviceURL, true);
1263
- http.setRequestHeader("Content-type", "application/json");
1217
+ http = createHeaders(http, options);
1264
1218
  http.setRequestHeader("Authorization", `Bearer ${options.access_token}`);
1265
- if (window.localeSettings) {
1266
- http.setRequestHeader("accept-language", window.localeSettings);
1267
- }
1268
1219
  http.send();
1269
1220
  } catch (ex) {
1270
1221
  reject(ex);
@@ -1333,10 +1284,7 @@ WebAuth.prototype.getDeduplicationDetails = function (options) {
1333
1284
  }
1334
1285
  };
1335
1286
  http.open("GET", _serviceURL, true);
1336
- http.setRequestHeader("Content-type", "application/json");
1337
- if (window.localeSettings) {
1338
- http.setRequestHeader("accept-language", window.localeSettings);
1339
- }
1287
+ http = createHeaders(http, options);
1340
1288
  http.send();
1341
1289
  } catch (ex) {
1342
1290
  reject(ex);
@@ -1369,10 +1317,7 @@ WebAuth.prototype.registerDeduplication = function (options) {
1369
1317
  }
1370
1318
  };
1371
1319
  http.open("POST", _serviceURL, true);
1372
- http.setRequestHeader("Content-type", "application/json");
1373
- if (window.localeSettings) {
1374
- http.setRequestHeader("accept-language", window.localeSettings);
1375
- }
1320
+ http = createHeaders(http, options);
1376
1321
  http.send();
1377
1322
  } catch (ex) {
1378
1323
  reject(ex);
@@ -1473,11 +1418,8 @@ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
1473
1418
  }
1474
1419
  };
1475
1420
  http.open("PUT", _serviceURL, true);
1476
- http.setRequestHeader("Content-type", "application/json");
1421
+ http = createHeaders(http, options);
1477
1422
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1478
- if (window.localeSettings) {
1479
- http.setRequestHeader("accept-language", window.localeSettings);
1480
- }
1481
1423
  http.send(JSON.stringify(options));
1482
1424
  } catch (ex) {
1483
1425
  throw new CustomException(ex, 417);
@@ -1507,11 +1449,9 @@ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
1507
1449
  }
1508
1450
  };
1509
1451
  http.open("GET", _serviceURL, true);
1510
- http.setRequestHeader("Content-type", "application/json");
1452
+ http = createHeaders(http, null);
1511
1453
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1512
- if (window.localeSettings) {
1513
- http.setRequestHeader("accept-language", window.localeSettings);
1514
- }
1454
+
1515
1455
  http.send();
1516
1456
  } catch (ex) {
1517
1457
  throw new CustomException(ex, 417);
@@ -1535,11 +1475,8 @@ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
1535
1475
  }
1536
1476
  };
1537
1477
  http.open("GET", _serviceURL, true);
1538
- http.setRequestHeader("Content-type", "application/json");
1478
+ http = createHeaders(http, null);
1539
1479
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1540
- if (window.localeSettings) {
1541
- http.setRequestHeader("accept-language", window.localeSettings);
1542
- }
1543
1480
  http.send();
1544
1481
  } catch (ex) {
1545
1482
  throw new CustomException(ex, 417);
@@ -1563,11 +1500,8 @@ WebAuth.prototype.reviewDevice = function (options, access_token, sub) {
1563
1500
  }
1564
1501
  };
1565
1502
  http.open("PUT", _serviceURL, true);
1566
- http.setRequestHeader("Content-type", "application/json");
1503
+ http = createHeaders(http, options);
1567
1504
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1568
- if (window.localeSettings) {
1569
- http.setRequestHeader("accept-language", window.localeSettings);
1570
- }
1571
1505
  http.send(JSON.stringify(options));
1572
1506
  } catch (ex) {
1573
1507
  throw new CustomException(ex, 417);
@@ -1597,11 +1531,8 @@ WebAuth.prototype.viewAcceptedConsent = function (options, access_token) {
1597
1531
  }
1598
1532
  };
1599
1533
  http.open("GET", _serviceURL, true);
1600
- http.setRequestHeader("Content-type", "application/json");
1534
+ http = createHeaders(http, options);
1601
1535
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1602
- if (window.localeSettings) {
1603
- http.setRequestHeader("accept-language", window.localeSettings);
1604
- }
1605
1536
  http.send();
1606
1537
  } catch (ex) {
1607
1538
  throw new CustomException(ex, 417);
@@ -1803,10 +1734,8 @@ WebAuth.prototype.authenticateFaceVerification = function (options) {
1803
1734
  }
1804
1735
  };
1805
1736
  http.open("POST", _serviceURL, true);
1737
+ http = createHeaders(http, options);
1806
1738
  http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
1807
- if (window.localeSettings) {
1808
- http.setRequestHeader("accept-language", window.localeSettings);
1809
- }
1810
1739
  http.send(JSON.stringify(options));
1811
1740
  } catch (ex) {
1812
1741
  reject(ex);
@@ -1842,10 +1771,7 @@ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
1842
1771
  }
1843
1772
  };
1844
1773
  http.open("GET", _serviceURL, true);
1845
- http.setRequestHeader("Content-type", "application/json");
1846
- if (window.localeSettings) {
1847
- http.setRequestHeader("accept-language", window.localeSettings);
1848
- }
1774
+ http = createHeaders(http, null);
1849
1775
  http.send();
1850
1776
  } catch (ex) {
1851
1777
  reject(ex);
@@ -1869,14 +1795,9 @@ WebAuth.prototype.progressiveRegistration = function (options, headers) {
1869
1795
  }
1870
1796
  };
1871
1797
  http.open("POST", _serviceURL, true);
1872
- http.setRequestHeader("Content-type", "application/json");
1798
+ http = createHeaders(http, options);
1873
1799
  http.setRequestHeader("requestId", headers.requestId);
1874
1800
  http.setRequestHeader("trackId", headers.trackId);
1875
- if (headers.acceptlanguage) {
1876
- http.setRequestHeader("accept-language", headers.acceptlanguage);
1877
- } else if (window.localeSettings) {
1878
- http.setRequestHeader("accept-language", window.localeSettings);
1879
- }
1880
1801
  http.send(JSON.stringify(options));
1881
1802
  } catch (ex) {
1882
1803
  reject(ex);
@@ -1942,10 +1863,10 @@ WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
1942
1863
  WebAuth.prototype.getDeviceInfo = function () {
1943
1864
  return new Promise(function (resolve, reject) {
1944
1865
  try {
1945
- const value = ('; '+document.cookie).split(`; cidaas_dr=`).pop().split(';')[0];
1866
+ const value = ('; ' + document.cookie).split(`; cidaas_dr=`).pop().split(';')[0];
1946
1867
  const fpPromise = fingerprint.load();
1947
- var options = {fingerprint:"", userAgent:""};
1948
- if(!value) {
1868
+ var options = { fingerprint: "", userAgent: "" };
1869
+ if (!value) {
1949
1870
  (async () => {
1950
1871
  const fp = await fpPromise;
1951
1872
  const result = await fp.get();
@@ -1959,10 +1880,7 @@ WebAuth.prototype.getDeviceInfo = function () {
1959
1880
  }
1960
1881
  };
1961
1882
  http.open("POST", _serviceURL, true);
1962
- http.setRequestHeader("Content-type", "application/json");
1963
- if (window.localeSettings) {
1964
- http.setRequestHeader("accept-language", window.localeSettings);
1965
- }
1883
+ http = createHeaders(http, options);
1966
1884
  http.send(JSON.stringify(options));
1967
1885
  })();
1968
1886
  }
@@ -1972,4 +1890,10 @@ WebAuth.prototype.getDeviceInfo = function () {
1972
1890
  });
1973
1891
  };
1974
1892
 
1893
+ // initiates a new user link to link two existing users
1894
+ WebAuth.prototype.userAccountLink = function (options, access_token) {
1895
+ var _serviceURL = window.webAuthSettings.authority + "/useractions-srv/users/" + options.sub + "/link";
1896
+ return createPostPromise(options, _serviceURL, false, access_token);
1897
+ };
1898
+
1975
1899
  module.exports = WebAuth;
@@ -15,7 +15,7 @@ declare class WebAuth {
15
15
  generateRandomString(length: any): string;
16
16
  generateCodeChallenge(code_verifier: any): any;
17
17
  base64URL(string: any): any;
18
- getLoginURL(): string;
18
+ getLoginURL(options?: {}): string;
19
19
  getAccessToken(options: any): Promise<any>;
20
20
  validateAccessToken(options: any): Promise<any>;
21
21
  getRequestId(): Promise<any>;
@@ -27,6 +27,8 @@ declare class WebAuth {
27
27
  getTenantInfo(): Promise<any>;
28
28
  logoutUser(options: any): void;
29
29
  getClientInfo(options: any): Promise<any>;
30
+ getDevicesInfo(options: any): Promise<any>;
31
+ deleteDevice(options: any): Promise<any>;
30
32
  getRegistrationSetup(options: any): Promise<any>;
31
33
  register(options: any, headers: any): Promise<any>;
32
34
  getInviteUserDetails(options: any): Promise<any>;
@@ -134,5 +136,6 @@ declare class WebAuth {
134
136
  deviceCodeVerify(code: any): void;
135
137
  userCheckExists(options: any): Promise<any>;
136
138
  setAcceptLanguageHeader(acceptLanguage: any): void;
137
- getDeviceInfo(options: any): Promise<any>;
139
+ getDeviceInfo(): Promise<any>;
140
+ userAccountLink(options: any, access_token: any): Promise<any>;
138
141
  }