cidaas-javascript-sdk 2.1.0 → 2.1.3

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/README.md CHANGED
@@ -770,7 +770,8 @@ This method takes an object as input.
770
770
  options = {
771
771
  sub: "7e4f79a9-cfbc-456d-936a-e6bc1de2d4b9",
772
772
  requestId: "7d86460b-8288-4341-aed1- 10dd27a4565c",
773
- accept-language: "en"
773
+ accept-language: "en",
774
+ access_token: "your_access_token"
774
775
  }
775
776
  ```
776
777
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "2.1.0",
3
+ "version": "2.1.3",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -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
- 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();
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
- let formData = new FormData();
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 = await fetch(window.webAuthSettings.authority + "/login-srv/login", {
465
+ const response = fetch(window.webAuthSettings.authority + "/login-srv/login", {
471
466
  method: "POST",
472
- body: formData
467
+ redirect: "follow",
468
+ body: searchParams.toString(),
469
+ headers: {
470
+ "Content-Type": "application/x-www-form-urlencoded",
471
+ }
473
472
  });
474
473
 
475
- const actualResponse = await response.json();
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
- try {
754
+ try {
758
755
 
759
- let formData = new FormData();
756
+ const searchParams = new URLSearchParams(options);
760
757
 
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", {
758
+ const response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
768
759
  method: "POST",
769
- body: formData
760
+ redirect: "follow",
761
+ body: searchParams.toString(),
762
+ headers: {
763
+ "Content-Type": "application/x-www-form-urlencoded",
764
+ }
770
765
  });
771
766
 
772
- const actualResponse = await response.json();
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<any>;
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<any>;
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;