I’m using the API of Discourse with a custom UI. I’m attempting to integrate this behind an orchestration layer that already authenticates users. I’d like to be able to more or less bypass authentication on the Discourse side of things.
We use JWT tokens, and it seems that ideally I could just pass these along to Discourse and tell it to trust them. I see that there’s some JWT related projects in the discourse GitHub organization, but there’s no documentation or usage examples, Google hasn’t been helpful, I haven’t found any relevant threads in meta, and I don’t really speak Ruby
Is there a way I could leverage our existing authentication by just passing these tokens through to Discourse?
Failing that, as an API user, how can I create topics and posts on behalf of other, authenticated users?
I’m trying to do this, but I cannot specify an arbitrary username as api_username - if I specify any username other than my (admin) account, I get a 404 from the API.
Is this post out of date, or is there some other way to achieve creating topics as another user (other than creating an API key for every user)?
Je vous écris car j’essaie de remplir mon forum avec des publications créées par un ensemble d’utilisateurs provenant d’un autre ancien forum.
La documentation explique comment créer un post via l’API, mais je ne suis pas sûr de la manière de faire en sorte que ces posts apparaissent comme étant rédigés par un utilisateur spécifique. La solution proposée ci-dessus semble ne plus fonctionner.
Existe-t-il un champ où je pourrais entrer le nom d’utilisateur ? Je ne le trouve pas dans la documentation.
Avez-vous envisagé d’essayer un script de migration ?
Cela pourrait être beaucoup plus simple. De nombreux tutoriels étape par étape sont disponibles ici sur Meta, en fonction de la plateforme sur laquelle tournait l’ancien forum.
Vous pouvez ensuite spécifier le nom d’utilisateur pour lequel vous souhaitez créer des publications via l’en-tête Api-Username lors de l’envoi de la requête API.
Merci @blake, je pense que c’est la voie que je vais emprunter. @justin merci, je préfère m’en tenir aux API pour le moment, mais je garderai l’importateur à l’esprit pour l’avenir !