Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jeswr/css-auth-utils

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jeswr/css-auth-utils

This is a temporary library for logging into the Community Solid Server using [client credentials](https://communitysolidserver.github.io/CommunitySolidServer/5.x/usage/client-credentials/).

  • 1.4.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CSS Auth Utils

This is a temporary library for logging into the Community Solid Server using client credentials.

import { getAuthenticatedFetch } from '@jeswr/css-auth-utils';

const fetch = getAuthenticatedFetch({
  podName: 'example',
  email: 'hello@example.com',
  password: 'abc123',
  url: 'http://localhost:3002/'
})

Logging in using the browser flow

In some testing use cases we wish to follow the browser login flow, but mock the user interaction with the browser. This can be achieved using the cssRedirectFactory which fills in the email and password and completes the user flow with the CSS using puppeteer.

Generally this should only be used when testing browser login flows in e2e tests.

import { cssRedirectFactory } from '@jeswr/css-auth-utils';

await session.login({
  oidcIssuer: 'http://localhost:3000/',
  redirectUrl: 'http://localhost:3001/',
  handleRedirect: cssRedirectFactory('hello@example.com', 'abc123')
});

If you just wish to get the session, and don't need to control the server for redirect URLs then you can do:

import { getSessionFromBrowserLogin } from '@jeswr/css-auth-utils';

const session = await getSessionFromBrowserLogin({
  email: 'hello@example.com',
  password: 'abc123',
  oidcIssuer: 'http://localhost:3000/',
});

[ESS] Logging in using the browser flow

import { essRedirectFactory } from '@jeswr/css-auth-utils';

await session.login({
  oidcIssuer: 'https://login.inrupt.com/',
  redirectUrl: 'http://localhost:3001/',
  handleRedirect: cssRedirectFactory('myUsername', 'abc123')
});
import { getSessionFromBrowserLogin, essRedirectFactory } from '@jeswr/css-auth-utils';

const session = await getSessionFromBrowserLogin({
  oidcIssuer: 'https://login.inrupt.com/',
  email: 'myUsername',
  password: 'abc123',
  redirectFactory: essRedirectFactory
});

License

©2023–present Jesse Wright, MIT License.

FAQs

Package last updated on 16 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc