# Localhost: A valid license key

**URL:** https://pdfjs.community/t/localhost-a-valid-license-key/1811
**Category:** Technical Support
**Created:** [June 27, 2022, 12:42pm UTC](https://pdfjs.community/t/localhost-a-valid-license-key/1811 "2022-06-27T12:42:10Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![vasheer](https://avatars.discourse-cdn.com/v4/letter/v/eada6e/32.png) [@vasheer](https://pdfjs.community/u/vasheer)
#### Post date: [June 27, 2022, 12:42pm UTC](https://pdfjs.community/t/localhost-a-valid-license-key/1811/1 "2022-06-27T12:42:10Z")

</div>

**Which product are you using?**

PDF.js Express Viewer  
**PDF.js Express Version**

| UI version | ‘8.4.1’ |
| --- | --- |
| Core version | ‘8.4.0’ |
| Build | ‘NC8xMi8yMDIyfDRkZTU3MmExYg==’ |
| WebViewer Server | false |
| Full API | false |

**Detailed description of issue**  
{Description here}  
I have the followed the setup for a viewer but no matter what I do I keep getting asked for a license key. I am using a license key as I will show in the code section.

I have taken the the zip file from the download page:

1. Unzipped it
2. npm install
3. npm serve
4. put my license key into the viewing.js file
5. It works
6. Move all the same code into my project and it doesn’t work because its looking for the license key.

I have also tried to do the install as shown on the manual integration getting started page:

> **[PDF.js Express Viewer Download & Integration | Documentation](https://pdfjs.express/documentation/get-started-viewer/manually)**

**Expected behaviour**  
{Provide a screenshot or description of the expected behaviour}  
I am expecting the license key to be read and used for my local domain (example.test). I have created a license key for the domain example.test incase it was not recognised as a local setup.

**Does your issue happen with every document, or just one?**  
{Answer here}  
The viewer has not loaded for me as yet.

**Link to document**  
{Provide a link to the document in question if possible}  
n/a  
**Code snippet**  
{Provide a relevant code snippet}  
\*\*Note that I am using the full correct license key from the [PDF.js Express](https://pdfjs.express/profile) page. I just removed it for the code below

```javascript
<head>
<script src="/js/PDFJSExpress/lib/webviewer.min.js"></script>
</head>
<body>
<div id="viewer"></div>
<body>
<script>
  WebViewer({
    path: '/js/PDFJSExpress/lib', // path to the PDF.js Express'lib' folder on your server
    licenseKey: XXXHRt',
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf',
  }, document.getElementById('viewer'))
  .then(instance => {
    // now you can access APIs through the WebViewer instance
    const { Core, UI } = instance;

    // adding an event listener for when a document is loaded
    Core.documentViewer.addEventListener('documentLoaded', () => {
      console.log('document loaded');
    });

    // adding an event listener for when the page number has changed
    Core.documentViewer.addEventListener('pageNumberUpdated', (pageNumber) => {
      console.log(`Page number is: ${pageNumber}`);
    });
  });
</script>

```

---

_[View the full topic](https://pdfjs.community/t/localhost-a-valid-license-key/1811)._
