@rubensworks/solid-client-authn-isomorphic
v2.0.1
Published
Isomorphic version of @inrupt/solid-client-authn-node and @inrupt/solid-client-authn-browser
Downloads
416
Maintainers
Readme
Isomorphic Solid JavaScript authentication
Handle authentication in an isomorphic manner so that it works in both Node.js and browsers.
This package is nothing more than a lightweight isomorphic proxy package.
When this package is used in Node.js, it acts as a proxy to @inrupt/solid-client-authn-node
.
When it is used in browsers, it acts as a proxy to @inrupt/solid-client-authn-browser
.
This package will only expose the components that are common between @inrupt/solid-client-authn-node
and @inrupt/solid-client-authn-browser
,
and are thereby safe to use in an isomorphic manner.
If you need specific components that only exist in either @inrupt/solid-client-authn-node
or @inrupt/solid-client-authn-browser
,
it is recommended to use one of those packages instead.
If you encounter any auth-specific bugs, it is recommended to report them at https://github.com/inrupt/solid-client-authn-js,
and make sure you are using it via @rubensworks/solid-client-authn-isomorphic
.
Installation
$ npm install @rubensworks/solid-client-authn-isomorphic
or
$ yarn add @rubensworks/solid-client-authn-isomorphic
Usage
All examples below are safe to use in both Node.js and browser environments.
Login
import { Session } from '@rubensworks/solid-client-authn-isomorphic';
const session = new Session();
await session.login({ oidcIssuer: 'https://solidcommunity.net/' });
Detect if in Node.js or browser
import { node, browser } from '@rubensworks/solid-client-authn-isomorphic';
if (node) {
console.log('Running in Node.js');
}
if (browser) {
console.log('Running in a Web browser');
}
All available components
import {
Session,
ISessionOptions,
ILoginInputOptions,
ISessionInfo,
IStorage,
NotImplementedError,
ConfigurationError,
InMemoryStorage,
node,
browser,
} from '@rubensworks/solid-client-authn-isomorphic';
License
This software is written by Ruben Taelman.
This code is released under the MIT license.