Code Monkey home page Code Monkey logo

hapi-joi-mongo-jwt-boilerplate's Introduction

HapiJS, Joi, MongoDB and JWT Boilerplate

The purpose and intent of this project is to provide a standardized template for establishing a secure API that will be used to connect to front-end / mobile applications.

Authentication Workflow (TBD)

All communication to be done over SSL/TLS.

The current plan is to introduce an assertation service to validate the client app. The API will store the client secret for the OAuth service. After validating the client token the API will return a JWT token to use with the client_token for all future calls.

  1. Client > Server* - Authentication request
  2. Server > Client* - Send validation command
  3. Client > Server* - Execute validation command and send the result
  4. Server > Client - Validate, generate and send client_token and code challenge PKCE-S256
  5. Client > OAuth2 - Validate user & receive auth_code using app-native OAuth SDK
  6. Client > Server - Send client_token, auth_code
  7. Server > Client - Verify client_token. Use client-secret, auth_code and code verifier to generate and store the access_token. Generate, store and send JWT token

SCRAM will be used as an alternative to using OAuth2 for the fallback authentication method on step 5.

* = To be replaced with Approov once app popularity reaches a critical point.

Commands

Build

npm run build

Debug

npm run build-dev

Run

npm run start

TODOs

  • Add app / client assertion endpoint
  • Complete OAuth2 validation logic and storage for JWT generation
  • Implement REDIS caching for valid JWT keys
  • For better scalability, the assertation client should be provisioned into it's own API / service.
  • Look at using typesafe-hapi instead of manually creating types

hapi-joi-mongo-jwt-boilerplate's People

Contributors

iknowcodesoup avatar

Stargazers

 avatar

Watchers

 avatar  avatar

hapi-joi-mongo-jwt-boilerplate's Issues

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.