New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

solid-auth-client

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-auth-client

Opaquely authenticates solid clients

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
263
increased by13.85%
Maintainers
1
Weekly downloads
 
Created
Source

solid-auth-client

Build Status Coverage Status

Opaquely authenticates solid clients

About

Solid currently supports two cross-origin authentication protocols, WebID-TLS and WebID-OIDC.

This library abstracts away the implementation details of these specs so that clients don't have to handle different authentication protocols.

API

This API doc uses flow type annotations for clarity. They're just here to show you the types of arguments expected by exported functions. You don't have to know anything about flow.

types

type authResponse =
  { session: ?session
  , fetch: fetch
  }

type session =
  { idp: string
  , webId: string
  , accessToken?: string
  , idToken?: string
  }

login

login (idp: string, {
  redirectUri?: string,
  storage?: Storage
}): Promise<authResponse>

Authenticates the user with their IDP (identity provider) and promises an object containing the user's session and a fetch function.

When the user is successfully authenticated, the session will be non-null and the fetch function (same API as whatwg fetch) can be used to request any resource on the web, passing credentials when necessary.

When the user is not found from the IDP, the session will be null, and the fetch will be a plain old fetch.

Auth flows like OIDC require the user to give consent on their identity provider. In such cases, this function redirects the user to their auth provider, which sort of breaks the promise. All you have to do is call currentSession when the user gives consent and lands back in your app.

If there's an error during the auth handshake, the Promise will reject.

Options:

  • redirectUri (default current window location): a URI to be redirected back to with credentials for auth flows which involve redirects
  • storage: An object implementing the storage interface for persisting credentials. localStorage is the default in the browser.

currentSession

currentSession (storage?: Storage): Promise<authResponse>

Finds the current session, and returns it along with a fetch function, if their session is still active, otherwise null and a regular fetch.

logout

logout (storage?: Storage): Promise<void>

Clears the active user session.

Note: this is an unsupported use case in WebID-TLS. Once your browser provides its client cert to a web server, there's no going back! So for WebID-TLS, the only thing this will do is clear the session from the store.

FAQs

Package last updated on 16 Jun 2017

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