npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-oidc-provider

v1.0.1

Published

A React component for authenticating users against a 3rd party OIDC provider

Readme

React OIDC Provider

Introduction

React OIDC Provider is a library that enables OIDC based authentication against a variety of public Authentication providers. Currently used in production in an Enterprise context against an Azure AD directory.

Using React OIDC Provider virtually removes the requirement for dealing with Authentication in your app.

Installation

The library can be installed using one of the following commands:

npm install react-oidc-provider

--or--

yarn add react-oidc-provider

Usage

The code below provides a minimal example component:

import React from 'react'

import { Provider, ProviderConfig } from 'react-oidc-provider'

const config: ProviderConfig = {
  authority: 'https://demo.identityserver.io/',
  clientID: 'implicit.shortlived',
  clientOrigin: 'http://localhost:3000',
  scope: 'openid email profile',
  responseType: 'id_token token',
  tokenExpiryWarningSeconds: 60,
}

const App: React.FC = () => {
  return (
    <Provider config={config}>
      {(user, isLoggedIn, error, isError, isLoading, isTokenExpiring, login, logout) => {
        if (isError) {
          console.log(error)
          return (
            <>
              <p>There is an Error. Logged to the console...</p>
            </>
          )
        } else if (isLoading) {
          return <p>Is Loading...</p>
        } else if (!isLoggedIn) {
          return (
            <>
              <p>User is Not Logged In</p>
              <button onClick={login}>Sign In</button>
            </>
          )
        } else {
          return (
            <>
              <p>User is Logged In</p>
              <p>User: {user && user.name}</p>
              <p>eMail: {user && user.email}</p>
              <p>Token Expiring: {isTokenExpiring ? 'YES' : 'NO'}</p>
              {isTokenExpiring && <button onClick={login}>Re-Authenticate</button>}
              <br />
              <button onClick={logout}>Sign Out</button>
            </>
          )
        }
      }}
    </Provider>
  )
}

The credentials provided are for a public hosted OIDC server.

The login screen you are redirected to provides some basic instructions for logging on with either a) using a static pair of credentils; or b) with any Google credentials.

Further information on the service and options provided are available via the following URL: https://demo.identityserver.io/

Samples

The samples folder contains a simple React application that leverages the component for login.

To run the minimal sample:

cd samples/simple <kbd>Return</kbd>
npm install --or-- yarn
npm start   --or-- yarn start

Issues

Please feel free to raise any issues via GitHub.

Future Enhancements

  • [ ] Add examples and configuration detail for popular OAUTH2 / OPENID providers.