> For the complete documentation index, see [llms.txt](https://docs.annoto.net/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.annoto.net/developers/wistia-plugin/using-widget-api.md).

# Using Widget API

In [Customise Widget Configuration](/developers/wistia-plugin/customise-widget-configuration.md) we've setup the Widget, similar to `onSetup` hook the Iframe Client API provides `onReady` hook. Once `onReady` is called, Annoto API actions can be performed:

```markup
<iframe src="https://fast.wistia.net/embed/iframe/r440odi4pc?seo=false&videoFoam=true&&plugin%5Bannoto%5D%5Bsrc%5D=https%3A%2F%2Fcdn.annoto.net%2Fwistia-plugin%2Flatest%2Fplugin.js" title="Borrowed video: Welcome to Wistia!" allow="autoplay; fullscreen" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen msallowfullscreen width="100%" height="100%"></iframe>
<script src="https://cdn.annoto.net/widget-iframe-api/latest/client.js"></script>
<script>
    var annoto = new AnnotoIframeApi.Client(document.getElementById("wistia-player-id"));
    annoto.onSetup(function(next) {
        next({
            clientId: 'eyJhbGciOiJIUzI1NiJ9...',
        });
    });
    annoto.onReady(function(api) {
        // recomended, so notifications will have URL to valid pages
        api.registerOriginProvider({
            getPageUrl: function() {
                return location.href;
            },
        });
        var token = 'eyJhbGciO...';
        api.auth(token, function(err) {
            if (err) {
                console.error('sso auth error: ', err);
            }
        });
    });
</script>
```

The `api` can be used to accomplish various tasks such as dynamically hide/show the widget, load new configuration and maybe the most common task to perform Single Sign On (SSO) authentication as demonstrated above.

{% hint style="info" %}
For full API documentation, please refer to the [AnnotoApi Reference](https://annoto.github.io/widget-api/interfaces/annoto.annotoapi.html).
{% endhint %}

{% hint style="warning" %}
The api object provided by the Iframe Client `annoto.onReady` has limited capabilities:

1. It does not support Promise based usage. It supports only callbacks.&#x20;
2. It support only the following methods: auth, load, close, show, hide, registerOriginProvider, logout.
3. registerOriginProvider supports only getPageUrl.
   {% endhint %}

{% hint style="success" %}
For more information regarding SSO, please refer to the Annoto SSO Technical Guide or contact us at <support@annoto.net>.
{% endhint %}
