CodexBloom - Programming Q&A Platform

OCI Object Storage: HTTP 403 Forbidden scenarios When Attempting to Access Pre-Signed URL

👀 Views: 2 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-11
oci object-storage python-sdk Python

Hey everyone, I'm running into an issue that's driving me crazy. I'm trying to configure 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 relatively new to this, so bear with me... I'm working with an scenario while trying to generate and access a pre-signed URL for an object stored in OCI Object Storage. I successfully generate the URL, but when I attempt to access it, I receive a 403 Forbidden behavior. Here's the code I'm using for the pre-signed URL generation: ```python import oci # Initialize the client config = oci.config.from_file() # Default config file object_storage_client = oci.object_storage.ObjectStorageClient(config) namespace = "my_namespace" bucket_name = "my_bucket" object_name = "my_object.txt" # Generate pre-signed URL pre_signed_url = object_storage_client.generate_presigned_url( "GET", namespace_name=namespace, bucket_name=bucket_name, object_name=object_name, expires_in=3600 # URL valid for 1 hour ) print(pre_signed_url) ``` When I try to access the generated URL, I get the following response: ``` HTTP/1.1 403 Forbidden Content-Type: application/json Content-Length: 59 { "code": "Forbidden", "message": "The requested operation is not permitted." } ``` I've double-checked the policies in the IAM console, and the user has `objectstorage.objects.get` permission for the bucket. I'm using the OCI Python SDK version 2.40.0. I also verified the namespace and object name are correct, and they match what's displayed in the OCI console. Is there something I'm missing regarding permissions or policies that would cause this 403 behavior? Any guidance would be greatly appreciated. My development environment is Ubuntu. What's the best practice here? I'd really appreciate any guidance on this. How would you solve this? This is my first time working with Python 3.11.