Skip to content

OpenID Connect authentication support for the solid-client library

License

Notifications You must be signed in to change notification settings

nodeSolidServer/solid-auth-oidc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solid-auth-oidc

Greenkeeper badge 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.

About

OpenID Connect authentication support for the solid-client library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5