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

sails-hook-oauth2

v2.0.2

Published

OAuth2 implementation for sails

Downloads

6

Readme

sails-hook-oauth2

An OAuth2 implementation for sails

For now only the login and token routes have been implemented as they're used the most

This package also includes some middleware that verifies the access token in the authorization header

Note: The version major had to be increased to v1.0 as the npm package was taken over

In the next few weeks I will write the readme

Features

  • Basic routes for logging in and using refresh token to generate a new access token
  • Middleware to check credentials given

Installation

  • install using npm (npm install sails-hook-oauth2)
  • set up a config like shown in lib/defaultConfig.js (a real example config will follow later)

Usage (middleware)

Every route that does not start with /oauth2/ will automatically run the middleware before going further on to policies and controllers (todo: make this a config option)

The middleware extends the req object by adding an oAuth object.

req.oAuth contains the following properties:

  • authenticated bool - will only be set to true if the callback from verifyAccessToken does not give an error
  • accessToken string - contains the access token the middleware found (in the Authorization header)

In addition to these when the callback from verifyAccessToken supplies an object for the authData parameter, all these properties will be added to req.oAuth

Todo's

for first stable release (v1.5):

  • Write readme
    • Write about login and token routes
    • Describe all config properties
  • Write some tests
  • Add some basic policies to be used in sails
  • Add example configs and policies

for future releases:

  • Add the other OAuth2 routes (like authorize)