Add an extra user document validation NodeJS + Okta


Following this article by @Braden Kelley I manage to create a full functional REST CRUD API

I was wondering if it’s possible to assign a unique id for each user.

For example: let’s say we have 10 users, each user will have it’s own username and password but a unique id. In order the user to be authenticated all fields must match. Otherwise the user will not authorized even if the username and password is correct.

If the user use the correct id and login details then will return token within the current id.

What I’m trying do is retrieve the relative MongoDB document id to the appropriate okta user. Instead of looking for all documents in the MongoDB.