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

oneauth

v0.7.2

Published

[![Build Status](https://travis-ci.org/coding-blocks/oneauth.svg)](https://travis-ci.org/coding-blocks/oneauth) [![CircleCI](https://circleci.com/gh/coding-blocks/oneauth.svg?style=svg)](https://circleci.com/gh/coding-blocks/oneauth) [![Coverage Status](h

Downloads

18

Readme

oneauth

Build Status CircleCI Coverage Status Code Climate CodeFactor codebeat badge Known Vulnerabilities Total alerts Language grade: JavaScript

Flattr this git repo

Design and Styles

IMPORTANT NOTE The css is picked from motley If there are any UI changes to be made, please make on motley.

Installation

Step 1 : Database Setup

Step 2 : Deploy

Deploy

Running Locally (for Development)

Option 1: Without SSL, only local logins

Simple clone and -

npm install
git submodule init
git submodule update
npm run start:dev

Option 2: With SSL (HTTPS), and try out social logins too

If you want to run it with https, and run it on a proper domain (not 127.0.0.1), and enable Facebook/Twitter/Github logins, you'll need to take care of a few additional steps -

Please read the required steps in the wiki


OAuth2 Server Usage

oneauth is an OAuth2 server, that you can consume

A few terms to remember -

| Term | Definition | | -----|------------| | auth token | A token, used in lieu of user+password credentials, to make API requests | | grant code | A code that can be exchanged for a auth token | | client id | Unique identifier for each client | | client secret| A secret key, to be used to exchange codes for tokens |


Grant Code Flow (frontend + backend clients)

This will get you a grant code (that can be exchanged for an auth token). Redirect the user to the below URL on the frontend

GET
http://localhost:3838/oauth/authorize?
        response_type=code
    &   client_id=9990781661
    &   redirect_uri=http://hackerblocks.com/callback

Then from your backend get the auth token

POST
http://localhost:3838/oauth/token

    {
         "client_id" : 9990781661,
         "redirect_uri" : "http://hackerblocks.com/callback",
         "client_secret" : "ZyTe3zCR67REHND7CHa9zH39NllvLWYULCedocZDLaCkSVTA7GGE1s1Hjrgkos09",
         "grant_type" : "authorization_code",
         "code"  : "MyiLDqJwTpzEXqYOG1jNFCtjEzYHAR4U"
     }

Retrieve the bearer token from the response body

Ensure you do not leak client secret to the frontend

Read in detailed step by step instructions in the wiki


Implicit Auth Token Flow (pure frontend clients)

This will get you a bearer token straight away on frontend

GET
http://localhost:3838/oauth/authorize?
        response_type=token
    &   client_id=9990781661
    &   redirect_uri=http://hackerblocks.com/callback

Retrive the bearer token from the URL


Oauth2 Consumer Usage

oneauth is also an OAuth2 consumer, so users can link other accounts they have on Facebook/Twitter/Google etc

Pages

/login

Existing user login

/signup

New user signup

/user/me

User profile data of logged in user

/user/{userid}

User profie data (only public data) of any user

/clients

All clients created by currently logged in user

/clients/{clientid}

Details of the client (given the user who owns it is logged in)

Maintenance

Database Backup / Restore

Backup

sudo -u postgres pg_dump oneauthdb -f oneauthdb.sql

Restore

PGPASSWORD=******* psql -U oneauthadmin -h <dbhost> -p <dbport> -d oneauthdb < oneauthdb.sql

Drop All Tables (this prints all the drop commands)

select 'drop table if exists "' || tablename || '" cascade;' 
  from pg_tables
 where schemaname = 'public';

Credits

Libraries Used

This is built upon the insanely useful and easy to use Oauth2 libraries built by jaredhanson from auth0

Inspirations

We built this at @coding-blocks looking at a similar solution hasgeek has here - http://github.com/hasgeek/lastuser We made our own, instead of using lastuser, because (a) the documentation was a little lacking on lastuser, and (b) we were more comfortable on a NodeJS+Postgres based stack.

Support on Beerpay

You can support the project via BeerPay Buy us a beer !

Beerpay Beerpay