Eliminate file security error in Meteor by utilizing Filestack

I've been working on integrating the react filestack plugin with meteor, and I'm running into issues when enabling the security settings to remove uploaded files. To delete a file, I need to utilize

App Secret, policy, signature, apikey
. However, I keep getting an error message stating
Error: security policy and signature are required to remove
, along with another error requesting the App Secret. Any thoughts on what might be causing this issue?

Path: ImageUpload.jsx

import React from 'react';
import PropTypes from 'prop-types';
import ReactFilestack from 'filestack-react';

export default class ImageUpload extends React.Component {
  constructor(props) {
    super(props);
    this.state = {};

    this.handleImageUpload = this.handleImageUpload.bind(this);
    this.handleDelete = this.handleDelete.bind(this);
  }

  handleImageUpload(result) {
    console.log('Image upload worked');
  }

  handleDelete() {
    console.log("Remove image worked");
  }

  render() {
    const options = {
      fromSources: ["local_file_system","webcam","facebook","instagram","dropbox"],
      accept: 'image/*',
      maxFiles: 1,
      transformations: { crop: { force: false } },
      storeTo: {
        location: 's3',
      },

    };

    const security = {
      policy: 'mypolicykey',
      signature: 'mysignuture',
      handle: 'imagehandle'
    };

    return (
      <div>
        <ReactFilestack
          apikey={'myapikey'}
          buttonText="Upload image"
          buttonClass="btn btn-secondary"
          options={options}
          onSuccess={this.handleImageUpload}
          security={security}
        />

        <ReactFilestack
          apikey={'myapikey'}
          buttonText="Delete image"
          buttonClass="btn btn-secondary"
          options={security}
          onSuccess={this.handleDelete}
          mode={'remove'}
        />
      </div>
    );
  }
}

Path: settings-dev

{
  "public": {
    "filepicker":{
      "secret": "mysecertapp",
      "policy": "mypolicy",
      "signature": "mysignature"
    }
  },
  "private": {
  },
}

Answer №1

When you attempt to delete something, make sure you pass the security or signature:

    <ReactFilestack
      apikey={'myapikey'}
      buttonText="Delete image"
      buttonClass="btn btn-secondary"
      options={security}
      onSuccess={this.handleDelete}
      mode={'remove'}
    />

It seems like there is a mistake with options={security}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I retain the state of the MUI X Premium DataGrid Toolbar?

I'm having trouble storing the toolbar's state in local storage with MUX Premium to persist my column order. I have tried various solutions from this thread but none of them seem to work for me.. Here is a snippet of my code: const apiRef = ...

Guide to transferring and transporting React to a different Application

I've developed two Apps named App1 and App2, both of which were created using create-react-app. However, App1 was created as a package using rollup and then linked with npm using 'npm link' or 'npm link [package name]'. When tryin ...

Tips for passing props to multiple child components in Vue?

In Vue, I'm curious about how to achieve the same functionality as declaring an object in React and passing it to multiple child components. const shared_props = { prop1: 'value1', prop2: 'value2', prop3: 'value3', ...

Displaying and concealing a component using onClick in React with Material UI

I want to create a functionality where the Material UI Box component opens when clicking on a Button and closes when clicking on the Button again. I have searched for solutions on Google but couldn't find anything straightforward. I am looking for a s ...

Can you provide guidance on implementing StyledComponents within the app folder of Next.js version 13?

Quoting information from the Next.js documentation: Attention: CSS-in-JS libraries that rely on runtime JavaScript are currently not compatible with Server Components. The following libraries are supported in Client Components within the app directory: s ...

Exploring the implementation of --history-api-fallback in webpack

let path = require('path') module.exports = { entry:path.resolve('public/src/index.js'), output: { path:__dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ exclude: / ...

Transferring information from a React form to an ExpressJS backend and then seamlessly redirecting to the PayuMoney platform for secure payment processing

Challenge Overview : I am currently working on the integration of payuMoney in a website built with ReactJS, NodeJS, and Express. The goal is to create a form where users can input their data, and then pass this information to the backend API located in in ...

What is preventing me from navigating to other pages in my React application?

Recently, I have been experimenting with ReactJS and encountered an issue where I couldn't access my other pages. The code snippet provided below seems to be the root of the problem. I am in the process of developing a multi-page application using Re ...

Strategies for displaying error messages in case of zero search results

I am currently developing a note-taking application and facing an issue with displaying error messages. The error message is being shown even when there are no search results, which is not the intended behavior. Can someone help me identify what I am doing ...

Attempting to contain the dimensions of the image within the confines of the card results in failure

Currently, I am designing custom cards featuring an image in the form of a water droplet... However, I am encountering difficulties in maintaining the proper drop shape across varying screen resolutions. Any guidance on this issue would be greatly valued. ...

What sets apart the CSS file directories in a React application compared to those in an Express server?

For instance, there is a public folder that contains all the css files, and a separate view folder for ejs files. When linking the css file in the ejs file, the code usually looks like this: <link rel=”stylesheet” href=”styles.css”> or like ...

An unparalleled nextjs middleware that seamlessly functions across all routes without requiring individual imports

TLDR; A middleware similar to express for Next.js where I can define it once and have it automatically apply to all routes. I am looking for a middleware style like what we have in express. Ideally, I would define the middleware in the server.js (entry f ...

Bypass React Query execution when the parameter is null

I am facing an issue with a react query problem. I have a separate file containing all the queries: const useFetchApTableQuery = (date: string): UseQueryResult => { const axiosClient = axios.create() const fetchApTableQuery = async (): Promise<A ...

Struggling with React integration of AdminLTE3 sidebar treeview?

I have a requirement to create a React sidebar with a category 'Staff' that, when clicked, reveals three subordinate categories. Below is the code snippet: import React, { Component } from "react"; export default class Sidebar extends Componen ...

Why is my custom 404 page failing to load after building my Next.js application?

I recently set up a custom 404 page for my Next.js app and wanted to test it locally before deploying to the server. To do this, I used the "serve" package to host the project on my local machine. However, when I tried navigating to a non-existent page, th ...

Issue with React container not connecting properly

I am currently facing an issue with a search bar where the input value is not displaying properly. Even when I check the value in the console, it only shows one character at a time. https://i.stack.imgur.com/Qm0Lt.png My assumption is that there might be ...

Enhancing User Experience with React-Redux: Implementing Subcategory Visibility based on Main Category Selection

How can I implement action logic to show and hide elements based on user interaction with main categories? Currently, all subcategories are being displayed at once, but I want them to be shown only when a user clicks on the corresponding main category. For ...

implementing GraphQL lists in mutations using Apollo in a React JS application

My current situation involves a mutation that looks like this: orderAdd(products: [ProductInput],restaurant: RestaurantInput) implemented in graphql, and now I want to pass parameters to it using Apollo in react js as shown below: mutation orderAdd ($ ...

Deciding on the Best Option for Your Admin Dashboard: Next.js 13 AppRouter vs. Pure React

When creating an admin dashboard, should I opt for Next.js 13 App router or stick to building a single-page application with pure React? I've noticed that Next.js can struggle with interactivity on slower connections. Which approach would provide bett ...

Adding a data attribute to a Material-UI Button: A step-by-step guide

I'm trying to include a custom data attribute in the Material-UI Button Component as shown here. Here's what I attempted: <Button inputProps={{ 'data-testid'='clickButton' }} > Click </Button However, this approach ...