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

grant-server

v3.1.1

Published

Packaged grantjs OAuth server so you can run it immediately via command line. Perfect for microservice architecture.

Downloads

11

Readme

Grant Server

Codecov CI semantic release

This module is a packaged Grant OAuth proxy server. That means that you can just install this package and run grant-serve to have a proxy OAuth server running.

Install

npm install grant-server

run it:

grant-serve

Table of Contents

How it works

After installing, you will need a grant configuration file to set up different OAuth providers. By default, the module looks for grant.config.json file in the currently executing directory. The server will automatically watch for changes in the configuration file and it will automatically reload.

example configuration file with Google auth:

{
  "defaults": {
    "origin": "http://localhost:3000",
    "prefix": "/oauth"
  },
  "google": {
    "key": "CLIENT_ID",
    "secret": "CLIENT_SECRET",
    "callback": "https://redirect-user-to-your-app.com",
    "scope": ["openid"]
  }
}

By using the file above we are enabling google OAuth point on http://localhost:3000/oauth/google, and we are asking for OpenID scope. After the tokens have been acquired, the caller will be redirected to https://redirect-user-to-your-app.com with the tokens available via query parameters.

Command line options

  • -c or --config Grant configuration file. If not provided, by default server will look for grant.config.json in the currently executing directory.

  • -d or --debug Enable writing tokens to stdout. It uses request-logs module. If only the flag is passed it will default to res,json otherwise you can customize what the output will be e.g. -d res,req,json,body

  • p or --proxy By default internal express app will have trust proxy flag set to true. You can pass in false to disable the proxy. Or use any of the options supported by the express app

Docker image

Docker image is available on docker hub. Image is based on github releases, so it's always up to date.

Docker usage

Pull the image:

docker image pull ivandotv/grant-server

Run the container:

docker run -it -v /config-dir:/opt/grant-server/config-dir ivandotv/grant-server -d -c config/config.json

Few things to keep in mind when using the docker image.

  • Server is started in /opt/grant-server directory inside the container.
  • Make sure that the exposed port is the same as in the configuration file.
  • If you mount only the external config file: -v config.json:/opt/grant-server/config.json Automatic reloading of the server will not work, because the server will not see the changes in the file. Better option is to mount the directory where configuration file is located: -v /config-dir:/opt/grant-server/config-dir and then pass the -c flag to the container like so: -c config/config.json.