User Tools

Site Tools


integration-api:example

This is an old revision of the document!


Web Integration API - Example

<!DOCTYPE html> <html xmlns=“http://www.w3.org/1999/xhtml” lang=“en”> <head> <script type=“text/javascript” src=“/aducid-resources/js/jquery.min.js”></script> <script type=“text/javascript” src=“/aducid-resources/js/aducid-api.js”></script>

<script type=“text/javascript”>

  var aducid = new ADUCID();
  $(document).ready(function() {
      aducid.setAuthentication();
      aducid.setStartOperationUrl("/aducid-binder/open");
      aducid.setResultOperationUrl("/aducid-binder/openCheck");
      aducid.setProxyUrl("/aducid-binder/proxy");
      aducid.setRedirectUrl("/aducid-binder/");
      aducid.processResult = function(result) {
          if (result.status == "OK" || result.status == "ALF") {
              alert("Success - status: " + result.status);
              location.href = result.redirect;
          }
          else {
              alert("Error - status: " + result.status);
              location.href = result.redirect;
          }
      }
      //handle PEIG not installed error
      aducid.showPeigError = function() {
          alert("peig not found or other error");
      }
      //handle communication or other error
      aducid.handleError = function(e) {
          alert(e.data.message);
      }
      aducid.showQRHint = function(param) {
          $('#qr-code-hint').html("scan QR or click button to authenticate");
      }
      aducid.showRunningHint = function(param) {
          $('#qr-code-hint').html("operation is runníng");
      };
      //GUI mapping
      aducid.setButton($("#main-button"));
      aducid.setQrCode($("#qr-code"));
      aducid.setQrHint($("#qr-code-hint"));
      //start
      aducid.init();
  });

</script> </head> <body>

<h1>LOGIN PAGE</h1>
<div>
	<button id="main-button">LOGIN using local PEIG</button>
</div>
<img id="qr-code" alt="" />
<div id="qr-code-hint"></div>

</body> </html>

integration-api/example.1534864029.txt.gz · Last modified: 2018/08/21 15:07 by tjotov