jQuery Web App
Choose API Version:
V3 V2

View the full sample project on Github

Step 1. Add dependency

Add jQuery dependency

<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.0.min.js"></script>

Step 2. Configure your button(s)

<span id="idme-wallet-button"
  data-scope="military"
  data-client-id="[YOUR_CLIENT_ID]"
  data-redirect="[YOUR_REDIRECT_URI]"
  data-text="[YOUR_OFFER_DESCRIPTION]"
  data-response="token"
  data-op="signin"
  data-show-verify="true">
</span>
<script src="https://s3.amazonaws.com/idme/developer/idme-buttons/assets/js/idme-wallet-button.js"></script>

Step 3. Call ID.me's API

Create an object for the parameters

var token = window.location.hash.split("&")[0].match(/[^#access_token=]\w+/)[0];
var parameters = {
  url      : "https://api.id.me/api/public/v3/attributes.json?access_token=" + token,
  dataType : "jsonp"
};

Make a $.get request and on .done, based on the verified attributes, display a message in console.log that the user is verified.

var payload = $.get(parameters).done(function(response) {
  payload = response;

  if (payload.status[0].verified) {
    console.log("User verified!")
  }
});

You can check the user's attributes and verification statuses from the payload['attributes'] and payload['status'] arrays.