Ich habe Discourse gestern aktualisiert und erhalte bei allen API-Rückrufen einen Fehler. Ich habe herausgefunden, dass das Problem in den Authentifizierungs-Headern liegt (1). Bei einigen Testaufrufen erhalte ich jedoch diesen Fehler:
Zugriff auf XMLHttpRequest an 'https://mydomain.com/notifications.json?username=admin' von der Herkunft 'https://mydomain.com' wurde durch die CORS-Richtlinie blockiert: Das Anforderungs-Header-Feld api-username ist in der Preflight-Antwort von Access-Control-Allow-Headers nicht erlaubt.
Ich verwende Vue und habe den api-key und api-username wie folgt zu den Headern hinzugefügt:
You are putting your system API key in client side code?
This means that anyone can grab it from your Javascript code and use it to completely own your forum.
Any Ajax HTTP requests to Discourse should be leveraging an existing session, or not be needing a session at all.
In my case I have SSO with a frontend app in javascript, Could I consuming the API without using the authorization UI for every user? I would like a way that a could use de api-username … is that possible?