cidaas-javascript-sdk 2.1.0 → 2.1.1
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/package.json
CHANGED
|
@@ -435,21 +435,21 @@ WebAuth.prototype.getRequestId = function () {
|
|
|
435
435
|
// login with username and password
|
|
436
436
|
WebAuth.prototype.loginWithCredentials = function (options) {
|
|
437
437
|
try {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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();
|
|
453
453
|
|
|
454
454
|
} catch (ex) {
|
|
455
455
|
throw new CustomException(ex, 417);
|
|
@@ -460,21 +460,18 @@ WebAuth.prototype.loginWithCredentials = function (options) {
|
|
|
460
460
|
WebAuth.prototype.loginWithCredentialsAsynFn = async function (options) {
|
|
461
461
|
try {
|
|
462
462
|
|
|
463
|
-
|
|
464
|
-
for (let key in options) {
|
|
465
|
-
if (options.hasOwnProperty(key)) {
|
|
466
|
-
formData.append(key, options[key]);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
463
|
+
const searchParams = new URLSearchParams(options);
|
|
469
464
|
|
|
470
|
-
const response =
|
|
465
|
+
const response = fetch(window.webAuthSettings.authority + "/login-srv/login", {
|
|
471
466
|
method: "POST",
|
|
472
|
-
|
|
467
|
+
redirect: "follow",
|
|
468
|
+
body: searchParams.toString(),
|
|
469
|
+
headers: {
|
|
470
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
471
|
+
}
|
|
473
472
|
});
|
|
474
473
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
return actualResponse;
|
|
474
|
+
return response;
|
|
478
475
|
|
|
479
476
|
} catch (ex) {
|
|
480
477
|
throw new CustomException(ex, 417);
|
|
@@ -754,28 +751,25 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
|
|
|
754
751
|
|
|
755
752
|
// initiate verification and return response
|
|
756
753
|
WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
|
|
757
|
-
|
|
754
|
+
try {
|
|
758
755
|
|
|
759
|
-
|
|
756
|
+
const searchParams = new URLSearchParams(options);
|
|
760
757
|
|
|
761
|
-
|
|
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", {
|
|
758
|
+
const response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
|
|
768
759
|
method: "POST",
|
|
769
|
-
|
|
760
|
+
redirect: "follow",
|
|
761
|
+
body: searchParams.toString(),
|
|
762
|
+
headers: {
|
|
763
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
764
|
+
}
|
|
770
765
|
});
|
|
771
766
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
return actualResponse;
|
|
767
|
+
return response;
|
|
775
768
|
|
|
776
769
|
} catch (ex) {
|
|
777
770
|
throw new CustomException(ex, 417);
|
|
778
|
-
}
|
|
771
|
+
}
|
|
772
|
+
|
|
779
773
|
};
|
|
780
774
|
|
|
781
775
|
// verofy account
|
|
@@ -20,7 +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<
|
|
23
|
+
loginWithCredentialsAsynFn(options: any): Promise<Response>;
|
|
24
24
|
loginWithSocial(options: any, queryParams: any): void;
|
|
25
25
|
registerWithSocial(options: any, queryParams: any): void;
|
|
26
26
|
getMissingFields(options: any): Promise<any>;
|
|
@@ -32,7 +32,7 @@ declare class WebAuth {
|
|
|
32
32
|
getInviteUserDetails(options: any): Promise<any>;
|
|
33
33
|
getCommunicationStatus(options: any): Promise<any>;
|
|
34
34
|
initiateAccountVerification(options: any): void;
|
|
35
|
-
initiateAccountVerificationAsynFn(options: any): Promise<
|
|
35
|
+
initiateAccountVerificationAsynFn(options: any): Promise<Response>;
|
|
36
36
|
verifyAccount(options: any): Promise<any>;
|
|
37
37
|
initiateResetPassword(options: any): Promise<any>;
|
|
38
38
|
handleResetPassword(options: any): void;
|