Installing using npm

At this moment we only support installation through our private npm registry. Read the prerequisite to learn how to get access to this registry.

If you’re unfamiliar with npm, consider using our CDN instead.

Step 1: Add the Autheos npm registry#

Once you have acquired a registry token, create a file named .npmrc next to your package.json and add the following line to it:


This will tell npm to fetch all packages within the @autheos scope from the Autheos registry. Of course, replace with your own registry token. This is not the same token as a CDN token.

Step 2: Installing the embed code#

Once you added the Autheos npm registry to your configuration, you can install the embed code like any other package.

Using npm:

npm install --save @autheos/embedcode

Alternatively, if you use Yarn:

yarn add @autheos/embedcode

Step 3: Include CSS into your build#

To make sure the UI features such as the thumbnail, carousel and popup show correctly on your website, you’ll need to include the embed code CSS into your build process. We ship plain CSS only; no precompilers are necessary.

Example usage with CSS imports:

@import '~@autheos/embedcode/dist/autheos-embedcode.min.css';

This step is optional. CSS is only required when you want to use our UI features like the popup, button or thumbnail.

Step 4: Include polyfills#

The Autheos embed code makes use of the fetch and Promise APIs, which are not natively supported by older browsers such as IE10 and IE11. You’re free to use any polyfill you like, but you’ll need one to support older browsers.

If you’re not using polyfills for fetch and Promise yet, the easiest way is to include them is to import @autheos/embedcode/lib/polyfill once:

// using ES6 modules
import '@autheos/embedcode/lib/polyfill';

// using CommonJS modules

The included polyfills are unfetch for fetch and promise-polyfill for Promise.

Step 5: Using Autheos#

You can now import the embed code to your application like this:

import * as Autheos from '@autheos/embedcode';

Or using require:

const Autheos = require('@autheos/embedcode');

There are other functions available (.button, .thumbnail, .inline). All functions can be found here.