Giter Club home page Giter Club logo

nodejs-oauth2-server's Introduction

nodejs-oauth2-server

login/signup implementation which based on oauth2, support multi-tenant, and 3rd part login via facebook, twitter, wechat, weibo

Installation

git clone https://github.com/jackieju/nodejs-oauth2-server.git
npm install
npm start or node ./bin/www

Quick Start

test code flow:

In browser http://localhost:3000/oauth/authorise?response_type=code&client_id=democlient&redirect_uri=http://localhost/cb&state=teststate&scope=profile

GET /oauth/authorise?response_type=code&client_id=democlient&redirect_uri=http://localhost/cb&state=teststate&scope=profile 200 Will redirect to login page

GET /login?redirect=/oauth/authorise 200 login using admin/admin

POST /login?redirect=/oauth/authorise 302 222.979 ms - 76 redirect to /oauth/authorise

GET /oauth/authorise 200 will render authorization form because session has userid

form will be post to /oauth/authorise

then should be direct to http://localhost/cb?code=xxxxxxxx

step 2: get token post http://localhost:3000/oauth/token with form: code=9fd70f9cd96697144066ffa3d69bb8b8b1b44785&grant_type=authorization_code&client_id=democlient&state=teststate& client_secret=democlientsecret&redirect_uri=http://localhost/cb

test js flow(implicit flow)

In browser http://localhost:3000/oauth/authorise?response_type=token&client_id=democlient&redirect_uri=http://localhost/cb&state=teststate&scope=profile

test open api

http://localhost:3000/me?access_token=c6459dd390b3d015bc4a0f80fef3b9cedd8cef56

After running with node, visting http://127.0.0.1:3000 should present you with a json response saying your access token could not be found.

Features

  • Supports authorization_code, implicit(user agent) password, refresh_token, client_credentials and extension (custom) grant types
  • Implicitly supports any form of storage e.g. PostgreSQL, MySQL, Mongo, Redis...

nodejs-oauth2-server's People

Contributors

jackieju 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.