You can use some powerful solutions for system authorization but if you want to reduce the number of dependencies, you can write something of your own. System authorization is one of the key parts. You can use some powerful solutions, such as Firebase, or one of the many good libraries.
Source: https://dzone.com/articles/nginx-nodejs-perform-identification-and-authentica