Can I use the Discourse API to authenticate users in another app?

What’s your top 3 suggestions on open-source to that specific task?

I’m using Nginx but probably that could be managed with a more robust development like Keycloak?