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 🙏

© 2024 – Pkg Stats / Ryan Hefner

npme-auth-auth0

v2.0.1

Published

Auth0-based npme authentication module

Downloads

22

Readme

npme-auth0

Auth0-based npme authentication module

Build Status

Configuring npme to use the instance

On the server:

  1. cd /usr/local/lib/npme/data
  2. sudo npm install npme-auth-auth0
  3. sudo vi auth0.json
  4. In this new file add the following config:
{
    "logLevel": "debug", // one of 'debug', 'info', 'warn', 'error'.
    "auth0Connection": "", // name of the auth0 connection
    "auth0ClientId": "", // auth0 client id
    "auth0Secret": "", // auth0 client id
    "auth0Domain": "" // auth0 domain,
    "metadataNamespace": "" // namespace used for your auth0 rules (see below)
}

In auth0:

set up a rule to enrich the profile returned with the admin and bucket properties:

function (user, context, callback) {
  const namespace = 'https://my.cool.unique.namespace';
  console.log(context.connection, context.connection === 'npme-external-users');
  if (context.connection === 'npme-external-users') {
    context.idToken[`${namespace}/admin`] = user.app_metadata.admin;
    context.idToken[`${namespace}/bucket`] = user.app_metadata.bucket;
  }

  callback(null, user, context);
}

Debugging

If the container will not start

  1. npm install -g rekcod - this package reverse-engineers docker containers
  2. sudo rekcod npme-auth - this will return a long command that shows how to initialise the container manually
  3. copy the command returned in step 2 and make the following changes: a. prefix with sudo b. remove the -d c. add the -it flag d. remove the --name npme-auth flag e. remove the --restart on failure:50000 flag f. replace /etc/npme/start.sh at the end of the command with ash
  4. execute the command you just built, and run start.sh in the new terminal. This should help you figure out what is causing the container to not start successfully.

Viewing the logs on a running instance

There's probably a better way than this, so if you know one, open a PR!

  1. ssh to your npm instance
  2. cd /usr/local/lib/npme/data
  3. sudo docker ps | grep npme-auth to get the container id of the auth instance
  4. sudo docker exec -it [container id from previous step] less /tmp/npme-auth-auth0.log to view the logs.