CodexBloom - Programming Q&A Platform

Trouble Configuring OCI Object Storage for a Cross-Platform Mobile App with Flutter and Dart

šŸ‘€ Views: 0 šŸ’¬ Answers: 1 šŸ“… Created: 2025-09-28
OCI Flutter Dart Object Storage Mobile Development

I can't seem to get I'm working on a personal project and I've been struggling with this for a few days now and could really use some help... I'm sure I'm missing something obvious here, but Currently developing a mobile app using Flutter and Dart, I need to integrate Oracle Cloud Infrastructure (OCI) Object Storage for user-uploaded content. The goal is to enable users to upload images and videos seamlessly. After setting up the OCI account and creating a bucket, I wasn't sure how to authorize these uploads securely. Documentation suggests using presigned URLs for secure object uploads, but I'm struggling with the Dart implementation. I tried using the `http` package to send a PUT request to the presigned URL but keep getting a 403 Forbidden error. The presigned URL was generated on the server side with the following code: ```python import oci client = oci.object_storage.ObjectStorageClient(config) bucket_name = 'my_bucket' object_name = 'user_uploaded_file.jpg' # Generate presigned URL url = client.generate_presigned_url( 'put_object', namespace_name='my_namespace', bucket_name=bucket_name, object_name=object_name, expiration_seconds=3600 ) ``` On the client side, I'm using the following Dart code to upload: ```dart import 'package:http/http.dart' as http; Future<void> uploadFile(String url, File file) async { var request = http.MultipartRequest('PUT', Uri.parse(url)); request.files.add(await http.MultipartFile.fromPath('file', file.path)); var response = await request.send(); if (response.statusCode == 200) { print('Upload successful!'); } else { print('Upload failed with status: ${response.statusCode}'); } } ``` After adjusting permissions in the OCI console to ensure that the Object Storage service has access, the same error persisted. I've also checked CORS settings for the bucket, allowing all origins, but that didn't help either. I’m curious if anyone else has configured OCI Object Storage with Flutter, especially in handling the presigned URLs correctly. Any insights or code snippets would be greatly appreciated! This is part of a larger API I'm building. My development environment is Linux. What's the best practice here? For context: I'm using Dart on Windows. Thanks in advance! I'm coming from a different tech stack and learning Dart. What would be the recommended way to handle this? For reference, this is a production service. Thanks for any help you can provide!