GithubHelp home page GithubHelp logo

apeixinho / oneauth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from championswimmer/oneauth

0.0 2.0 0.0 1.25 MB

Your one-stop Single Sign-on server. Login with Oneauth to your services. Login to Oneauth using Facebook/Twitter/Github

Home Page: https://account.codingblocks.com

JavaScript 67.60% CSS 1.00% HTML 31.38% PLSQL 0.03%

oneauth's Introduction

oneauth

Code Climate bitHound Code bitHound Dependencies CodeFactor codebeat badge

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)


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

oneauth's People

Contributors

championswimmer avatar himankbhalla avatar vdvibhu20 avatar dhroov7 avatar flaredragon avatar bhavyaagg avatar mukulsaini avatar sd5869 avatar abhishek97 avatar witty123 avatar lazy-god avatar shaz13 avatar adityahirapara avatar firefinchdev avatar architkshk avatar piyush0 avatar yagya-chaudhary avatar avaniverma avatar codingblocks-bot avatar himanshuc3 avatar till-tomorrow avatar sahilharjai avatar codacy-badger avatar tech4gt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.