-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
500 on request #223
Comments
Okay, I updated from 0.5 to 0.10. Now it says If I use webapppassword. If I use the legacy API, it returns the right response.
The cors error still persists, but I am testing in postman |
Hey, sorry for the late reply. Webapppasswords share api wrapper works with POST requests only. Try the following: const result = await fetch(`${this.server}/index.php/apps/webapppassword/api/v1/shares`, {
method: 'POST',
headers: {
Authorization: `Bearer ${this.token}`,
// Authorization: `Basic ${btoa('user:password')}`,
'Content-Type': 'application/json',
'OCS-APIRequest': 'true',
},
body: JSON.stringify({
path: pathToYourFile,
shareType: 3, // check out nextcloud docs for a list of supported share types. The most common one is 3.
password: shareFilePassword,
expireDate: expireDate ? expireDate.toISOString() : null,
}),
}) |
Hello,
I think its rather an error with the way I use it, but I cannot figure it out.
With postman I tried to test with
GET https://domain/index.php/apps/webapppassword/api/v1/shares?path=/Assessments/Max%20Mustermann/11.09.2024/8ed25dc5-d4f6-4a3f-9e51-05024ccb38e3.mp4
Authorization with Basic
Nextcloud 28.0.5
Header OCS-APIRequest to true
As return in the body it returns me the HTML code of nextcloud
<title> Nextcloud </title>`
Nextcloud
Internal Server Error
The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.
When I embed that into my application it returns me a cors error
Access to fetch at 'https://domain/index.php/apps/webapppassword/api/v1/shares?path=/Assessments/Max%20Mustermann/11.09.2024/8ed25dc5-d4f6-4a3f-9e51-05024ccb38e3.mp4' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Code:
`const fetchVideoShareLink = async (path) => {
// Extract the part starting from "/Assessments"
const cleanPath = path.substring(path.indexOf("/Assessments"));
console.log(cleanPath)
};`
Any idea what I am doing wrong?
The text was updated successfully, but these errors were encountered: