Hi @dpramanik,
There are several ways to go about this.
- You can set up a rule that calls your API and creates a user in your DB. When the call completes successfully, have it add a flag to your user’s app_metadata, stating they have been added to mongo. Have this rule run for any user who is missing the flag.
OR
- Add the user to the database when you get the token. When your next app gets the user’s token, search for their user_id (the
sub
claim in the token) in mongo, and if you can’t find it then add them to the DB.
There are quite a few threads talking about each approach, I would just hit the search function and you should be able to find some examples of how to implement.