A question to the developers of nodebb, please improve the api docs. The api is great but is lacking explanation in many cases.
M
Martijn Michel
@Martijn Michel
Posts
-
Improve API Docs -
api/admin/upload/file always 401ive found this post, but i dont understand how to get a csrf token
https://community.nodebb.org/topic/6932/how-to-get-a-csrftoken-from-an-api-req-object/4 -
api/admin/upload/file always 401@pitaj said in api/admin/upload/file always 401:
X-Csrf-Token
ok, and what would be the value of that?
-
api/admin/upload/file always 401let headers = { "Authorization": "Bearer -hidden-", "Authentication": "Bearer -hidden-", 'Content-Type': 'application/json;charset=utf-8' };
I am sending it from a cordova app
-
api/admin/upload/file always 401@martijn-michel that url should be Rapi + 'admin/upload/file?_uid=1'
both endpoints dont work -
api/admin/upload/file always 401I've implemented several endpoints of my nodebb forum into an app and they work fine. But somehow I can't seem to upload a file because it always gives either a cors error or a 401 unauthorized error
I have no problems with cors on other endpoints.
Can anyone give a good example how to use this endpoint with fetch?
Right now I have: (the image being a base64 string)
return await fetch(Rapi + `post/upload?_uid=1`, { method: 'POST', body: JSON.stringify({ files: [image] }), headers }).then((response: any) => response.json());