Comment générer _forum_session et _t pour un utilisateur via un appel de code/API ou sans connexion au navigateur ?

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.