Google OAuth 2.0
Assignment 3
Due before our week 13 class.
Counts for 10% of your final grade.
# The brief
This is the third of three take home assignments related to building a backend web service to support a simple pokemon application called pokemon.
In the previous assignments you built the base for the pokemon RESTful API using Node.js, the Express framework and MongoDB. For this assignment you will enhance that foundation with Google OAuth 2.0 authentication.
In addition to correctly implementing all of the requirements from the previous assignment. The application will implement the following.
# Core Requirements
- Create a new
/auth
router module that will support
- redirecting a user to google api for authentication
- handle the callback from google
- logging out the current user
The user schema should have the following properties:
Property Type Required name String true googleId String true createdAt Date true updatedAt Date true All
GET
requests are available to authenticated or unauthenticated users.All
POST
,PUT
,PATCH
, andDELETE
routes for the pokemon resource paths should be limited to authenticated users.Ensure that you write clean and readable code. Pay attention to:
- no runtime errors
- consistent 2 space indentation
- logical grouping of related code
- semantically descriptive names for variables and functions
- well organized project folder structure
- properly formatted
package.json
file- correct project name
- your author details
# Logistics
- Create a new folder in you
mad9124
repository. - Copy your previous Pokemon code.
- Build the project on your laptop.
- Test each route with Postman.
- Make git commits as you complete each requirement
- When everything is complete, push the final commit back up to GitHub and submit the GitHub repo's URL on Brightspace.
TIP
It is a good habit to make a git commit as you complete each logical requirement. This not only tracks your progress, but protects your working code in case you later break it and need to roll back.