¿Cómo generar _forum_session y _t para un usuario a través de código/llamada API o sin iniciar sesión en el navegador?

If what you are trying to do is to let people log in to Discourse using your other app, or to log in to your other app using Discourse, then you want to implement DiscourseConnect, that I linked to above. You can see that page for documentation and code examples.