Allowing Flutter application and Springboot application to access Azure blob - flutter

I am creating an application using Flutter for frontend and Spring boot for backend. I want to access profile pictures of users stored as Azure blob using the URL of the image obtained from the server. This will enable the application to load the image as a network image.
But when I try to use the URL, following error is generated
<Error>
<Code>PublicAccessNotPermitted</Code>
<Message>Public access is not permitted on this storage account. RequestId:821d181e-601e-0059-639d-39d3fd000000 Time:2023-02-05T20:06:23.0221204Z</Message>
</Error>
The problem is that the Springboot application has access to the storage account using SAS token, but the flutter application will have no access.
Is there a way to allow the flutter application to access the azure storage for the blobs?

Related

How to use service account to authenticate Cloud Run to Firestore

I'm looking for a way to connect Cloud Run to Firestore without using a service account access key. I have a key set up for my local dev environment to access Firestore. I know you can access Firestore from the account running Cloud Run containers, but haven't been able to find any documentation on how to do this.
The most I could find is using a Workforce Identity Federation but that seems to be focused on connecting external services which isn't my goal.
Edit, forgot to mention I'm using nodejs and am not using firebase, just firestore
Every service in Cloud Run has a service account assigned (default Compute Engine service account), but you can create you own service account and assign it (Recommended), you don't need to download a key.
Cloud Run console
In the IAM section look for datastore permissions instead of Firestore permissions, because Firestore is the 'evolution' of datastore.
Follows the doc for more info: https://cloud.google.com/run/docs/configuring/service-accounts

Flutter upload file to s3 - using only dart code

I'm trying to upload an audio file to s3. It seems like there is no straightforward approach. I found a few libraries.
https://pub.dev/packages/amazon_cognito_identity_dart
This one is incompatible with the latest dart version and there is no update information also. https://github.com/jonsaw/amazon-cognito-identity-dart/issues/27 So I couldn't use it.
https://pub.dev/packages/flutter_aws_s3_client - Got deprecated
https://pub.dev/packages/aws_s3
https://pub.dev/packages/amazon_cognito_identity_dart
https://pub.dev/packages/simple_s3-
3, 4, 5, and a few more libraries using AWS Cognito pool ID for authentication, But I found that to use the Cognito pool ID, our app user authentication should be done with this service. But In our app, authentication has already been created using the JWT token. So I couldn't AWS Cognito service. But still not sure completely as we can use Cognito pool ID with JWT token authentication.
Moreover, we can do it using the native code of iOS and Android and connect it using the flutter channel. But It seems too expensive in terms of time and complexity.
We have another way that we can send the media file to our backend server and from the server-side, we can upload it to the S3 bucket.
But I'm trying to figure out a way to do this from the frontend side itself.
Thanks for any suggestions.

How to access S3 bucket using Flutter Amplify without authentication from AWS cognito

I've created an S3 bucket and made its access level to public. I don't have AWS Cognito configured with the project. I need to use amplify_storage_s3 to get and put files to the bucket without a cognito userpool. Is this possible?
As per the official response here, it does not support.
currently it's not possible to use S3 plugin without Cognito as it is used to sign the S3 requests. You can enable guest access while configuring Auth through CLI such that your app's users wouldn't have to sign in to use S3 resources (by using the guest access)
But I found a probably workaround here

How to make IBM Bluemix Object Storage file publicly accessible?

On Bluemix, I created a Java application using Liberty for Java and the Object Storage Service. I then bound the Java Application and Object Storage Device. I uploaded the images into the container which I created in the Object Storage service. Now I want to access the uploaded images publicly, such as opening the images in a browser directly. I created the URL like the IBM Bluemix documentation said. After I access the URL in browser it shows the following error:
401 Unauthorized
Unauthorized
This server could not verify that you are authorized to access the document you requested.
My sample URL
Is it possible to make the URL public?
You can create a temporary public URL using the swift command line.
First you need to set a key and they create the temporary url. For example:
swift post -m "Temp-URL-Key:yourkey"
swift tempurl GET 3000 /v1/AUTH_90e12a182adf4a32bbd5e34645380244/offermsgs-cateimgs/books.jpg yourkey
The output of the command above will be your temporary public URL and in the example below it will be valid for 3000 seconds.
You can modify Object Storage ACL as well to make all files read only as suggested in the following post:
Public URLs For Objects In Bluemix Object Storage Service

Migrating Files from Parse.com to our hosted parse server [image]

I have migrated files from Parse.com to my hosted parse server using "https://github.com/parse-server-modules/parse-files-utils" tool by applying "Option-2".
Now My problem is when I click on the image in my hosted parse server dashboard, it will show me message "File not found." and my url is like,
http://ip of my server:1337/parse/files/OE9gP1wrd2OT9avp3RBmt8zysmM25wRTMtDOxsfe/tfss-6ca44378-72fb-4ddf-aef2-11af0485b11b-profile-pic
If I upload new image from mobile aap, its working fine.
I have installed mongodb and migrated parse.com data to newly created database in mongodb.
I am not using any FileAdapter in my new created parse server.
Thanks in advance, kindly please look into this issue and help me that how can I display migrated images in our hosted parse server.
What is the http error you are seeing (404?) Are you sure the error is "file not found"? Maybe your server folder permission is set not set to public, so you can't publicly access the files (should be a 403 error).
You usually store the image files to a container (storage) that can be accessed via APIs like Amazon (AWS) or Microsoft Azure. It's usually more efficient to keep you local server file storage small and have fast access speeds to your images.
You can find out how to setup an Amazon S3 bucket or Google Cloud Storage here.
You can find out how to setup an Azure Storage here and connect it to your parse-server using this adapter.
I'm not sure about AWS, but Google and Azure gives you free credits if you sign up, and (at least for Azure) the storage aren't too expensive, so the free credits can last you a while...