Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of S3 upload using STS #2949

Open
1 task done
lon9man opened this issue Nov 18, 2024 · 1 comment
Open
1 task done

Example of S3 upload using STS #2949

lon9man opened this issue Nov 18, 2024 · 1 comment
Labels
feature-request Request a new feature storage Related to the Storage category/plugins

Comments

@lon9man
Copy link

lon9man commented Nov 18, 2024

Before opening, please confirm:

Language and Async Model

Kotlin - Coroutines

Amplify Categories

Authentication, Storage

Gradle script dependencies

Environment information

Please include any relevant guides or documentation you're referencing

No response

Describe the feature request

Hello, team.
we need general guidance for the simplest example in the world.

we have:

  1. PHP API backend. it implements login-functionality
  2. android mobile application (and swift application also)
  3. AWS infrastructure

we need to implement:

upload to S3 from mobile apps

basic flow:

a) user logins using PHP API backend on mobile app. receives auth TOKEN back
b) user chooses file and presses button Upload

so to implement upload we should use for example Amplify.
BUT WITHOUT ANY COMPLEX WRAPPERS like Cognito, Sign-In with Apple, Sign-In with Amazon, Sign-In with Facebook and etc. we don't want to have user database on AWS or sync it there from PHP backend.

as far as i feel it is possible to make using STS. saying mobile app receives from PHP API backend temporary STS-token and will use it to call AWS. BUT i don't see how this STS can be injected into Amplify?

questions:

  1. what is SEVERAL possible approaches to implement this on simplest manner using our architecture?
  2. how to inject STS token into Amplify Storage and other services?

thanks!

Initialization steps (if applicable)

No response

Code Snippet

No response

amplifyconfiguration.json

No response

GraphQL Schema

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 18, 2024
@mattcreaser
Copy link
Member

mattcreaser commented Nov 18, 2024

Hi @lon9man - this (providing custom/non-cognito credentials) is not currently supported in the Amplify Storage category. I'll mark this issue as a feature request for this library.

That being said, it should be possible to use STS credentials by directly using the lower-level AWS SDK for Kotlin.

I can't give you in-depth support for the AWS SDK, but I believe that what you want to do is something like the following:

  1. Create a StaticCredentialsProvider with the credentials available from your service.
  2. Instantiate an S3Client and pass your credentials provider.
  3. Use the S3Client to upload your file.

If you have any issues or further questions about this I'd recommend posting a discussion question in the AWS SDK for Kotlin repository. Hope that helps!

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 18, 2024
@mattcreaser mattcreaser added storage Related to the Storage category/plugins feature-request Request a new feature and removed pending-triage Issue is pending triage labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature storage Related to the Storage category/plugins
Projects
None yet
Development

No branches or pull requests

2 participants