We are building a blogging application for topcoder members and need you to do it for us. So far we've designed the API but haven't started building any of the endpoints. First we need to implement authentication using OAuth2 for the API. Users should be able to login with their username and password. We may add social logins later but for now simply store their credentials in MongoDB and allow them to login with their u/p.
Implement OAuth2 authentication and security for the api so that it can be used eventually by the web app and by developers adding routes to the API. Make sure you include documentation so that other developers can implement your security with their routes. Your explanation should be clear and easy with sample code.