css-authn
TypeScript icon, indicating that this package has built-in type declarations

0.0.16 • Public • Published

css-authn

GitHub License NPM Version NPM Type Definitions

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@example.com',
  provider: 'https://solidserver.example',
  fetch, // (optional) you can also provide your own fetch compatible with native Node fetch
})

/css-authn/

    Package Sidebar

    Install

    npm i css-authn

    Weekly Downloads

    13

    Version

    0.0.16

    License

    MIT

    Unpacked Size

    41.8 kB

    Total Files

    22

    Last publish

    Collaborators

    • mrkvon