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

tr-oauth2

v2.0.0

Published

Very simple OAUTH2 token issuer and validator.

Downloads

1

Readme

In a Nutshell

A client library maintaining valid OAUTH2 client token as background operation.

Reference

const DOC = require('tr-oauth2');

var doc = new DOC('https://oauth2-auth-server.in.my.domain/oauth/token',
                  { grant_type: 'client_credentials' },
		  'my-username',
		  'my-very-secret-password');
doc.on('refresh', function(expiresIn) { console.log('Token refreshed.'); });
doc.on('error', function(e) { console.log(e); process.exit(1); });

In your code, you'll want to wait for the first refresh callback. After this, if everything works, doc.token will automatically be maintained so that it points to a valid token.

Server

While this package is mainly a client library maintaining a valid OAUTH2 token for some other use, there is also actually a fully functional OAUTH2 server that can yield access tokens for clients and can also handle token verification and revocation. User database is a CSV file (example in users.dat) and can contain also scopes and authorities. The token is a JWT token which is either signed with RSA key or using a static symmetric secret.

This is not really aimed for serious production use and it also naturally needs a HTTPS termination service (such as a nginx reverse proxy) in front of itself. However if someone spots a security problem, please report them so I can fix or document them.

Usage:
  oauthserver [<opt> ...]
  Options:
       --listen-address=<arg>   IP address the server listens to.
       --listen-port=<arg>      TCP port the server listens to.
       --token-ttl=<arg>        Default validity time for tokens in seconds.
       --token-issuer=<arg>     Issuer name to be included into tokens.
       --users-file=<arg>       CSV file containing users data.
       --secret-key-file=<arg>  Read token signing key from file.
       --public-key-file=<arg>  Read token verifying key from file.
       --secret=<arg>           Symmetric secret for token signing.
       --secret-file=<arg>      Read symmetric secret from file.
   -h  --help                   Show help and exit

Author

Timo J. Rinne [email protected]

License

GPL-2.0