admin管理员组文章数量:1128673
I'm working with the Nextcloud API and I've encountered an issue where joining a room is currently only possible if I have cookies, as it requires an active session. All my other API's are working fine.
const createApiClient = (baseURL, username, password) => {if (!baseURL || !username || !password) {
throw new Error("Base URL, username, and password are required to create an API client.");}const token = Buffer.from(`${username}:${password}`).toString("base64");return axios.create({
baseURL,
headers: {
Authorization: `Basic ${token}`,
"Content-Type": "application/json",
"OCS-APIRequest": "true",
},
withCredentials: true});};
router.post("/room/:roomID/call", check_parms, adminMiddleware, validateFieldsMiddleware(["roomID"]), async (req, res, next) => {
try {
let { roomID } = res.locals.json_req || {};
const response = await req.apiClient.post(`/ocs/v2.php/apps/spreed/api/v4/call/${roomID}`, {
flags: 3,
silent: false,
recordingConsent: false
});
console.log(response)
res.status(200).json(successResponse("User deleted successfully.", response.data.ocs.data));
} catch (error) {
return next(error);
}});
Its return 404
本文标签:
版权声明:本文标题:node.js - How can I generate a call from the Nextcloud API without requiring cookies for session management - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736712098a1949003.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论