cidaas-javascript-sdk 2.1.4 → 2.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -1845,6 +1845,28 @@ WebAuth.prototype.loginAfterRegister = function (options) {
1845
1845
  }
1846
1846
  };
1847
1847
 
1848
+ // device code flow - verify
1849
+ WebAuth.prototype.deviceCodeVerify = function (code) {
1850
+ const params = `user_code=${encodeURI(code)}`;
1851
+ const url = `${window.webAuthSettings.authority}/token-srv/device/verify?${params}`;
1852
+ try {
1853
+ const form = document.createElement('form');
1854
+ form.action = url
1855
+ form.method = 'GET';
1856
+ const hiddenField = document.createElement("input");
1857
+ hiddenField.setAttribute("type", "hidden");
1858
+ hiddenField.setAttribute("name", 'user_code');
1859
+ hiddenField.setAttribute("value", encodeURI(code));
1860
+
1861
+ form.appendChild(hiddenField);
1862
+ document.body.appendChild(form);
1863
+ form.submit();
1864
+ } catch (ex) {
1865
+ throw new Error(ex);
1866
+ }
1867
+ }
1868
+
1869
+
1848
1870
  WebAuth.prototype.userCheckExists = function (options) {
1849
1871
  var _serviceURL = window.webAuthSettings.authority + "/users-srv/user/checkexists/" + options.requestId;
1850
1872
  return createPostPromise(options, _serviceURL, undefined);
@@ -1854,4 +1876,4 @@ WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
1854
1876
  window.localeSettings = acceptLanguage;
1855
1877
  }
1856
1878
 
1857
- module.exports = WebAuth;
1879
+ module.exports = WebAuth;
@@ -131,6 +131,7 @@ declare class WebAuth {
131
131
  getMissingFieldsLogin(trackId: any): Promise<any>;
132
132
  progressiveRegistration(options: any, headers: any): Promise<any>;
133
133
  loginAfterRegister(options: any): void;
134
+ deviceCodeVerify(code: any): void;
134
135
  userCheckExists(options: any): Promise<any>;
135
136
  setAcceptLanguageHeader(acceptLanguage: any): void;
136
137
  }