JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q19288F
  • License MIT

Authentication library for Solid client based on OAuth2/OpenID Connect

Package Exports

  • solid-auth-oidc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (solid-auth-oidc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

solid-auth-oidc

NPM Version

A Javascript authentication plugin for solid-client based on OAuth2/OpenID Connect.

This is an Authentication helper library that wraps an OpenID Connect (OIDC) Relying Party library, oidc-rp. It is meant to be used in browser-side applications, as part of solid-client.

Usage

  // Using a standard "document loaded" event listener
  //  (equivalent to jQuery's $(document).ready())
  // Trigger a login() check on page load, in case user is logged in already
  document.addEventListener('DOMContentLoaded', function () {
    SolidClient.auth.login()
      .then(function (webId) {
        // User is logged in, you can display their webId, load their profile, etc
        // Solid.auth.webId is set to the current user's webId URI
        // Also, SolidClient.auth.accessToken is set to the current user's access token
      })
      .catch(function (error) {
        // An error has occurred while logging in, display it to user
      })
  })

Called by itself, login() will perform Provider Discovery and kick off the OAuth2/OpenID Connect /authorize process.