-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Explain the Problem
i have problem with using share api . doument tells we should use /apps/webapppassword/api/v1/shares instead /ocs/v2.php/apps/files_sharing/api/v1/shares as far as i found out. when i use /apps/webapppassword/api/v1/shares OPTIONS request is ok but i got cors error on request itself (POST) and when i use /ocs/v2.php/apps/files_sharing/api/v1/shares i get method not allowed error on OPTIONS request.
currently im using webapppassword and i have no problem with webdav apis
im using these apis in same project . how to call share apis without cors error
Steps to Reproduce
this is my axios call
const response = await axios.post(
'http://nc.develop/apps/webapppassword/api/v1/shares',
{
path: 'welcome.txt',
shareType: 0, // 3 represents "user" share type, change it based on your requirements
shareWith: 'sina',
permissions: 19,
password: "admin",
attributes:""
},
{
headers:{
"Authorization": "Bearer "+localStorage.getItem("access_token"),
"authorization": "Bearer "+localStorage.getItem("access_token"),
}
}
);
console.log('Share created:', response.data);
} catch (error) {
console.error('Error creating share:', error.message);
}
System Information
- WebAppPassword app version: 23.6.0
- Nextcloud version: 26.0.3
- PHP version: 8.1.2
Contents of nextcloud/data/nextcloud.log
nothing adds in log
Contents of Browser Error Console
Access to XMLHttpRequest at 'http://nextcloud_proxy_backend.develop/apps/webapppassword/api/v1/shares' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.