amplify-swift: Amplify Storage Works on Simulator but 403 on a device

Describe the bug Hey I have a project that uses amplify to interface with multiple services like lambda ,cognito, storage etc. But due to some reason storage(s3) always gives me a 403 on a device but works fine on a simulator. This similar problem occurred with lambda but I solved it by using Cognito as the authorisation type , im assuming the same is the issue with storage but im unable to find out how to change the autorization type from IAM to cognito.

To Reproduce Steps to reproduce the behavior: Run on simulator everything works fine Run on a device Storage gives a 403

Expected behavior Similar behaviour on simulator and device

Environment(please complete the following information):

  • Amplify Framework Version: 4.32.0
  • Dependency Manager: Cocoapods
  • Swift Version : 5.1

A part of my amplifyconfiguration.json is added below

    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify/cli",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "****",
                            "Region": "****"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": ""****",",
                        "AppClientId": ""****",",
                        "AppClientSecret": ""****",",
                        "Region": ""****","
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                },
                "S3TransferUtility": {
                    "Default": {
                        "Bucket": ""****",",
                        "Region": ""****","
                    }
                }
            }
        }
    },
    "storage": {
        "plugins": {
            "awsS3StoragePlugin": {
                "bucket": ""****",",
                "region": ""****",",
                "defaultAccessLevel": "guest"
            }
        }
    }

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (10 by maintainers)

Most upvoted comments

even after doing the above that you mentioned I get the following

StorageError: The HTTP response status code is [403].
Recovery suggestion: TODO some status code to recovery message mapper.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

@wooj2 Moreover I am unable to re-open this issue pls do so.