I would like to use the losant-rest-js library in the front end (browser). Where should I get the Javascript files to be included?
Is losant-rest-js available on a CDN?
The Github repo is a bit complex, I’m not sure if there is something simple and clearly encapsulated like a minified js file; I could only find a whole bunch of individual files which didn’t seem like the right approach for front-end usage.
We don’t provide a pre-bundled library for browsers. It’s usually brought into the browser using a module bundler like Webpack or Gulp.
That being said, there are very few use cases where we’d recommend accessing the Losant API directly from a browser. It’s primarily intended for service-to-service requests. The reason is because whatever user has your web page loaded will have access to the token being used for authentication. The Losant API provides fairly broad access to the underlying application and there’s no way to protect the token in a client-side environment.
When it comes to accessing Losant from a browser, we strong recommend building a custom API using Experience Endpoints. Your users then authenticate as Experience Users and receive a token that can only be used to access these Endpoints. You then have full control over what those users can access using workflows triggered by each request.