License for different bundle ID | Nutrient
You might see the following license error: NutrientError: Failed to initialize NutrientViewer: Invalid license key. Failed to activate NutrientViewer for ‘example.domain’. Error: Your license has been registered for a different bundle identifier - not “example.domain”. Each NutrientViewer license is only valid for one explicit bundle ID and one distribution method (Enterprise or public App Store). Please contact sales at https://www.nutrient.io/contact-sales with your requirements for a new license.
This error can be caused when you have both `example.domain` and `www.example.domain` licensed. Since you’re using the same license key for both domains, it can cause the error to happen intermittently, depending on whether the visitor uses `www.example.domain`.
{% alert line="single-line" %}Safari simplifies the domain that’s shown to you, so unless you click the address bar to show the full URL, it might show you `example.domain/`, even though it’s accessing `www.example.domain`.{% /alert %}
To make sure you’re loading the correct license key based on the domain your users are visiting, use something like the following:
```jslet licenseKey = null;if (document.location.host === "example.domain") { licenseKey = "<insert license key for example.domain>";} else if (document.location.host === "www.example.domain") { licenseKey = "<insert license key for www.example.domain>";} else { console.error("Invalid location -> escalate to ops");}We’re working on improving this error message so it’s clearer.
Additionally, it’s generally recommend to use a web app on only one subdomain — either www or no subdomain — as this can reduce potential problems. Refer to this page for more information(opens in a new tab).