API :: User widget

User widget is the right way to get Nexaas ID feature inside your application. The URL path is /api/v1/widgets/user.js. It returns a Javascript that enable rendering the widget where you want, and requires access token in a bearer authorization header or in the query string.

The script must be similar to:

<script>
  function initWidget(NexaasID) {
    var wrapper = document.getElementById('widgetWrapper');
    NexaasID.createUserWidget(wrapper);
  }
</script>

<script
  src="https://api.nexaas.id/api/v1/widgets/user.js?access_token=$ACCESS_TOKEN&callback=initWidget">
</script>

Where widgetWrapper is the ID for the HTML element that will contain the user widget, and the $ACCESS_TOKEN is the access token got from an authorization code.

Note: the user widget will NOT be rendered for signed out access.