You can start by using the Postman Collection
You should make requests in the order they are, there are automatic tests that will set the collection variables for you.
- NEVER use this in production, this implementation INSECURE, but it's a good start point to understand how OAuth 2.0 works
- This implementation is loosely based on 14gasher/oauth-example. Most things are different, but the initial idea and the starting point comes from his project.
- First, you should have a basic understanding of how Oauth2 works.
- Look at the Postman Collection on the quick overview section and do some requests, try to understand how they compare to the sequence diagram below.
- Go to the use-cases folder, and go folder by folder, in the same order as they are on the Postman Collection
- Inside each folder, you should read first the DTO file, and understand what is the request and response objects for each request
- To understand how the request parameters are used and how the response ones are generated, read the use-case file, which contains all the business logic
This OAuth2.0 implementation is meant to be an example for Toolbox CloudPass. Follow the official documentation for more detailed instructions. https://toolboxdigital.atlassian.net/wiki/spaces/DDP/pages/72293671/CloudPass+Integration+Guide+method+OAuth+2.0+Protocol
- Clone this Repo
- Go to project folder
cd nodejs-oauth2-server
- Install the dependencies
npm install
- Prepare the database
- Run the database migrations and populate
npm run db:migrate:populate
- Run the database migrations and populate
- Start the tests
npm run test
- Start the server
- Run in development mode
npm run dev
- Run in "production" (you shouldn't run this in production) mode
npm run start
- Run in development mode