css-authn
v0.0.16
Published
Authenticate to CommunitySolidServer using its API
Downloads
82
Maintainers
Readme
css-authn
Utilities to authenticate to Community Solid Server via its API
Supported versions are 6.x and 7.x.
This package is based on Automating authentication with Client Credentials v6 and v7.
Usage
import { v6, v7 } from 'css-authn'
// or import { createAccount, getAuthenticatedFetch } from 'css-authn/dist/7.x'
// the methods return a Promise, so you can wrap them in async function, and await them...
// get authenticated fetch
const authenticatedFetch = await v7.getAuthenticatedFetch({
email: 'email@example',
password: 'password',
provider: 'https://solidserver.example',
webId: 'https://solidserver.example/person/profile/card#me' // (optional) if there are multiple webIds associated with the account, you need to specify which one to authenticate with
fetch, // (optional) you can also provide your own fetch compatible with native Node fetch
})
// in version 7, there's also a method to create account and pod
await v7.createAccount({
username: 'username',
password: 'password',
email: '[email protected]',
provider: 'https://solidserver.example',
fetch, // (optional) you can also provide your own fetch compatible with native Node fetch
})