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

npuser-client

v1.0.19

Published

Module for a server that uses the npuser service (the no password authentication service).

Downloads

13

Readme

npuser-client

server API to access the npuser "No password user authentication" service

See https://github.com/bryan-gilbert/npuser

The npuser "no password user authentication" service is very easy to use both for the users of your application and for you the developer. npuser verifies that the user has access to the email address they have entered. This is as secure as any password based service that uses email to let users reset their password (e.g. forgot your password?)

Yet, npuser is more secure because the authorization service does not store any user data. There is zero risk of hackers breaking into the user authorization service and obtaining user ids and passwords because they simply don't exist.

npuser is easy for your users

Users simply enter their email address. Press submit. They then check their email for the verification code( just like the "forgot password" process). They enter the verification code and they are authenticated.

npuser is easy for developers

You'll use the npuser-client npm package to send two post methods; one with the email and then the second with the verification code. Check out the sample application.

Sample usage

The best way to see how to use this client of the npuser authentication services is to see the code in the sample-client folder.

  const np = new NoPasswordAuthorizer({
    baseUrl: config.NPUSER_URL,
    clientId: config.CLIENT_ID,
    sharedSecretKey: config.SECRET
  })

  const emailAddress = getEmailAddress()
  const authResponse = await np.sendAuth(emailAddress)
  
  const code = getCodeFromUser()

  const validationResponse = await np.sendValidation(emailAddress, authResponse.token, code)

A sample validation response:

Validation response: {
  message: 'User validated',
  jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNvbWVvbmVAZXhhbXBsZS5jb20iLCJ0b2RvIjoiY2FuIGFkZCBvdGhlciBkYXRhIGhlcmUgc3VjaCBhcyBjdXJyZW50IHRpbWVzdGFtcCIsImlhdCI6MTYwMjM0MzU5MH0.Kl_3PdWS3TRm_QzWMrcJi2jY2LLLvvZoSjfaSCNdwbA'
}

Store the jwt for later verification. Normally, you will send the jwt to the browser client and store it in the browser localstorage. Your client application can then send this jwt along with requests to your server. Your server can validate the jwt with the npuser authorization service to be sure the user has a valid authorization.

Module developer tasks

To bump the version

npm version patch

https://travis-ci.org/github/bryan-gilbert/npuser-client