nickredmark / ooth

User identity/authentication/accounts management microservice for node.js
https://nmaro.github.io/ooth/
MIT License
605 stars 65 forks source link

Enhance ooth Documentation #77

Open JohnathanMaravilla opened 5 years ago

JohnathanMaravilla commented 5 years ago

TL;DR: Please create detailed or enhance documentation for ooth packages.

I’m having a hard time understanding how ooth works from both a high-level and technical perspective and I believe that is partly due to the lack of documentation and most likely, mainly due to my coding inexperience. I initially stumbled across ooth (which I'm sure many others have) after searching for implementation methods and how specific components work for passportjs.

In my case, I'm trying to figure out how can I use ooth as a standalone microservice, implement cookie-based sessions and use neo4j as the backend. I've figured out how to do this with passportjs and thanks to the User Accounts with Next.js — An Extensive Tutorial, I was able to figure out a lot of things that I've been trying to do with my app, but I'm still clueless on how to implement the logic and features I need when it comes to ooth.

It would be nice for the documentation to updated in detail or elaboration for individuals who are not so well versed in the node/express - auth domain. Specifically, how each ooth module works and why specific parameters are required and what they do. As an example, in Ooth - a user identity management system in the 'Ooth backend' section under 'Ooth Server', "ooth-mongo" is used as an example (Soooo many mongo examples, everywhere! 😪 /rant), but I am unsure what other ooth strategies (plugins?) are available for use? My guess is that I can use any of the packages listed in the ooth repository and in my particular case, I maybe able to use the 'ooth-local' somehow or clone and modify the 'ooth-local' source to connect to a neo4j backend and create cypher queries for the returned results in the code. Because of the lack of documentation, I am not entirely sure that this would work because the example strategy/plugin used as the backend for the required core ooth module, but the plugins listed as options in the "Authentication strategies" within the documentation require the core ooth module to function; maybe those plugins are only reserved for the core ooth backend option. I am getting some idea of what is happening in the background by reviewing the source code, but as someone who is still trying to nail down the fundamentals of JS, it becomes somewhat confusing without documentation.

Here are some blog posts that helped me understand Passportjs a bit better, that the official documentation do not provide:

With this, I was able to figure out what data the mongo (😪) examples used in the official documentation was querying for and what information was being returned. For example, I had no idea that the official examples needed to return the user's ID and username in an object to so that it could be serialized. After understanding that, I knew what logic I needed to write to query my neo4j db and return that information in a way that the examples expected to serialize the user.