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

pub-pkg-github-oauth

v1.2.10

Published

pub-server style plugin for github oauth

Downloads

27

Readme

pub-pkg-github-oauth

NOTE: this package is no longer being maintained

This module provides a pub-server style plugin for github oauth.

It is used by pub-gatekeeper to mediate oauth access, allowing static sites hosted on github pages to be edited from the browser.

flow

  1. Browsers start by checking for an existing oauth access token at /server/auth/github/status using JSONP or similar mechanism. The first time they do this, it initiates a session with the pub-gatekeeper server, and the server returns a JSON object with no access_token.

  2. To start a new authentication process, browsers then navigate to /server/auth/github?ref={fully-qualified url}. The ref parameter specifies where to direct the browser after authentication. The server will immediately redirect to github's oauth page at https://github.com/login/oauth/authorize. New users will be asked to login, and confirm the scope of the auth request.

  3. After the user has confirmed oauth access, github will redirect back to the gatekeeper server at server/auth/github/callback. This triggers the 2nd step in the authentication process, in which the server requests a user-specific access token from github.

  4. When the response with the access token comes back, the gatekeeper stores this in the browser's session, and then redirects back to the ref parameter location from step 1, adding a temporary code parameter for fetching the access token.

  5. Step 1 is repeated with the temporary code, and this time, the request returns an access token. This token opens the door to perform commits or reads on the user's repo on github.

api

require('pub-pkg-github-oauth')(server);
  • server.app : express application used to mount routes
  • server.opts.github.url : route prefix defaults to '/server/auth/github'
  • server.opts.github.timeout : ms value defaults to '4s'.
  • server.opts.github.expire : ms for browser to fetch token

GitHub credentials

GitHub developer application credentials must be exported in the following environment variables.

export GHID={github client ID}
export GHCD={github client secret}