Search code examples
react-nativecloudinary

Best practise to upload image to cloudinary in React Native?


What is the best method to upload image in a react native app to cloudinary API?. Should I install their SDK from https://www.npmjs.com/package/cloudinary and use it inside the app after installing. Wont it cause any problems after compiling to apk?

Or should I use the manual way? With the fetch api in react native and sent a post request to the cloudinary API? Isn't that a bit too much work and at the same time not so secure, because API keys are exposed right? Whats your opinion?


Solution

  • While the React Native SDK is currently unavailable, it is recommended to use the direct call to the upload Rest API as implemented at the client-side of your application (see sample implementation in React). And you could pass the Cloudinary account parameters from your server-side code to your frontend as an option to manage the credentials.