import { handleIncomingRedirect, login, fetch, getDefaultSession } from '@inrupt/solid-client-authn-browser'
produces issues with “does not provide an export named” fetch or getDefaultSession. Anyone using @inrupt/solid-client-authn-browser in module style in an html page?
and copied to server location. But there is no bundle or other js in @inrupt/solid-client-authn-browser but there is a dist. Attempt running npm run build there but it is lacking sibling projects.
cd solid-client-authn-js
npm install
npm run build
and this does build and the bundle shows up ./solid-client-authn-js/packages/browser/dist/solid-client-authn.bundle.js. Copied everything in /solid-client-authn-js/packages/browser/dist to server location under ./js/solid-client-authn-browser/
and in the html did the
import { handleIncomingRedirect, login, fetch, getDefaultSession } from './js/solid-client-authn-browser/solid-client-authn.bundle.js'
Can see the solid-client-authn.bundle.js is served but no import. Tried rebuilding everything with "compiler option "module": "ES6" to the packages’ tsconfig.json" but no difference
Hi @jeffz if I take fetch out of the lineup it complains about getDefaultSession and so on. Somehow there is no module solid-client-authn-browser importable into these versions of browser. Can test on Chrome tonight.
When you import the library with a script tag you get an obect called solidClientAuthentication. You can then use, for example solidClientAuthentication.getDefaultSession() or same for solidClientAuthentication.login() and solidClientAuthentication.handleIncoomingRedirect. You can see a working example of these methods at https://solid.github.io/solid-rest/browser/examples/authn.html
I don’t know whether importing solid-client-authn-browser directly without the script tag is supported, I can’t get it to work using the CDN version of the library. Perhaps @nicolasmondada would know if it is supported.