Skip to content

Commit

Permalink
Set AWS credentials when generating pre-signed URLS
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed Dec 14, 2023
1 parent bda2113 commit 872cc9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion onadata/libs/utils/image_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def generate_aws_media_url(
signature_version=getattr(settings, "AWS_S3_SIGNATURE_VERSION", "s3v4"),
region_name=getattr(settings, "AWS_S3_REGION_NAME", ""),
)
s3_client = boto3.client("s3", config=s3_config)
s3_client = boto3.client(
"s3",
config=s3_config,
aws_access_key_id=s3_client.access_key,
aws_secret_access_key=s3_client.secret_key,
)

# Generate a presigned URL for the S3 object
return s3_client.generate_presigned_url(
Expand Down

0 comments on commit 872cc9e

Please sign in to comment.