# css-authn

> Authenticate to CommunitySolidServer using its API

Latest version **0.4.0** (published 2025-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-authn
pnpm add css-authn
yarn add css-authn
bun add css-authn
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2025-11-28 |
| First published | 2024-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 125.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | mrkvon |
| Keywords | solid, solidproject, linked-data, community-solid-server |

## Links

- npm: https://www.npmjs.com/package/css-authn
- Repository: https://github.com/mrkvon/css-authn
- npm.io page: https://npm.io/package/css-authn

## Dependencies (1)

- [@inrupt/solid-client-authn-core](https://npm.io/package/@inrupt/solid-client-authn-core.md) ^3.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2025-11-28
- 0.3.0 — 2025-07-05
- 0.2.1 — 2025-05-06
- 0.2.0 — 2025-05-06
- 0.1.1 — 2025-03-26
- 0.1.0 — 2025-01-30
- 0.0.16 — 2024-05-04
- 0.0.16-alpha.0 — 2024-02-25
- 0.0.15 — 2024-02-25
- 0.0.15-alpha.3 — 2024-02-25
- 0.0.15-alpha.2 — 2024-02-25
- 0.0.15-alpha.1 — 2024-02-25
- 0.0.15-alpha.0 — 2024-02-24
- 0.0.14 — 2024-01-13
- 0.0.13 — 2024-01-13
- … 12 more at https://npm.io/package/css-authn/versions

## README

# `css-authn`

[![GitHub License](https://img.shields.io/github/license/mrkvon/css-authn)](https://github.com/mrkvon/css-authn/blob/main/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/css-authn)](https://npmjs.com/package/css-authn)
![NPM Type Definitions](https://img.shields.io/npm/types/css-authn)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mrkvon/css-authn/test.yml)

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](https://communitysolidserver.github.io/CommunitySolidServer/6.x/usage/client-credentials/) and [v7](https://communitysolidserver.github.io/CommunitySolidServer/7.x/usage/client-credentials/).

## Usage

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

## License

MIT (c) 2024 mrkvon

### Notice

This code is substantially based on [Community Solid Server documentation](https://github.com/CommunitySolidServer/CommunitySolidServer/blob/main/documentation/markdown/usage/client-credentials.md) with [license](https://github.com/CommunitySolidServer/CommunitySolidServer/blob/main/LICENSE.md):

```md
MIT License

Copyright © 2019–2025 Inrupt Inc. and imec

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

---
_Source: https://npm.io/package/css-authn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
