littleGauze / koa2-oauth2-server

OAuth2 Server with mongodb storage for koa2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

koa2-oauth2-server

This project is a demo for OAuth2-server package usage with grant_type of authorization_code

Quick Start

  • I use the mongodb for the oauth2-server model, so you should run a local mongodb server first.

  • And then create a database (I use the name of test).

  • Add a client document to oauthclients collection like below:

    { 
      "_id" : ObjectId("5d0904b86ead30545165865d"), 
      "clientId" : "clientid123", 
      "clientSecret" : "clientsecret123", 
      "grants" : [
          "authorization_code", 
          "refresh_token"
      ], 
      "redirectUris" : [
          "http://localhost:3001/authCallback"
      ]
    }

    more collection name see here

  • start the client and oauth2 server

    • install yarn or npm init
    • client yarn client or npm run client
    • server yarn start or npm start

Documentation

Demo

About

OAuth2 Server with mongodb storage for koa2


Languages

Language:JavaScript 81.8%Language:HTML 18.2%