Build a REST API using ExpressJS and use a third-party authorization API like GitHub to allow users to log in to your application. OAuth is an efficient and simple way to get access to protected data from an external application. It is more secure than asking users to log in with passwords.
- Create an Express server to service requests from clients
- Build an html page that will be called when a client request is made to the root path of the application
- Maintain all the static files in a separate folder
- Redirect the user to GitHub to provide login credentials
- Using the code from GitHub, get an access token
- Login to the Node.js application and write the token in the cookie
- Download and unzip the boilerplate code.
- Run the command
npm install
to install the dependencies. - Open the boilerplate code in VSCode to develop the solution.
- Write the logic in .js file present in src folder
- Do not modify the html and css files present in the static folder
- Create the server in the app.js file
- Register the application on Github under OAuth applications
- Update
config.js
with CLIENT ID and CLIENT SECRET generated by the Github application
- Execute the
npm start
command to start the application - Test the output on the browser
-
Run the test scripts available under src/test by giving
npm run test
command in the terminal to test locally. -
Refactor the solution to ensure all test cases are passing.
-
Zip the solution code with the name same as assignment name.
-
Upload the zipped solution for submission.