Authentication for SPA & API with Mongo DB Atlas

I have an SPA based on Angular and an ASP .NET Core API. My app uses data stored on Mongo Db Atlas.

I would like to authentify my users. I thought about using the Mongo Db Atlas App Services. That means that my users would be stored on Mongo Db side.

Is it a good idea to delegate this authentication part to MongoDb or could it be done differently ? In fact, I want to use the MFA, mailing & monitoring part already handled by Mongo Atlas and I cannot seem to find any other solution.

I have already tried ASP .NET Core Identity but it seems so “hand-crafted” especially for MFA. Do you have any ideas, please ? Thanks

Hello @Mary_Be ,

Welcome to The MongoDB Community Forums! :wave:

Delegating user authentication to MongoDB Atlas App Services can be a good idea, especially if you’re already using MongoDB Atlas for your data storage and want to take advantage of the MFA, mailing, and monitoring features.

You can secure App Services Apps with built-in user management. With the built-in user management of App Services, only authorized users can access your App. You can delete or disable users, and revoke user sessions. Users can log in with:

You can enable one or more authentication providers in the App Services backend, and then implement them in your client code. Please check below resources to learn more about Authenticating a User.

You can also add an OAuth and OpenID Connect layer on top of your existing database of users. Please refer

App Services keeps a log of application events, records metrics that summarize your App’s usage and performance, and publishes notifications to your Atlas project’s activity feed. Please check below link to learn more about this.

I hope this helps! :slightly_smiling_face:
Let me know if you need any help or have any queries/facing issues with implementation.

Regards,
Tarun