How to upload a file/image to Azure Blob using React Native (Expo)?

Viewed 1743

I am trying to figure out how to upload an image to Azure Blob in React Native (Expo) without ejecting it from the Expo. So rn-fetch-blob and react-native-azure-blob-storage do not work in my case as they require ejecting from the Expo.

I was thinking of using a solution found here, but I wonder if there is a better solution out there. Do you know any? Please let me/us know.

1 Answers

If you do not want to use SDK to upload a file, then you can upload a file via REST API. The solution you found is correct, it uses the storage account key to compute a signature to make your request authorized. It is a bit complex.

There is also an easier way. You can authorize with Azure Active Directory. In this way, you can easily get an access token for accessing your storage account.

Related