Implementation of "Hello S3" application tutorial was successful using SDK built with WinHTTP but not cURL? #3094
-
After having built the SDK using MSVC on my windows machine (both with and without cURL support) in accordance with the instructions, I tried implementing the "Hello S3" application tutorial. Running the application using the default SDK built with WinHTTP, I was able to successfully obtain a list of S3 buckets I owned. However, I received the following error when I attempted to run the same application that used the SDK built with cURL:
When I examined the log file, it seemed like the program encountered a lot of SSL connection timeouts and failed connections. Though it was eventually able to complete a series of TLS handshakes and verify my certificate file, the final http response was unable to be parsed. I have attached the source code and a snippet of my log file (not really sure how much I should include). Why did authentication seemingly fail and why is there a parsing error? I suspect that for the former, the code confirmed authentication using cURL without knowing where the certificate file was and I'm not sure how to set that. As for the latter, I have no clue.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hello @KreedM Thanks for reaching out! For detailed instructions, you may refer to the AWS DOCUMENTATION. Do let me know if anything else is needed. Thanks |
Beta Was this translation helpful? Give feedback.
-
Hello @KreedM When authenticating using aws configure sso and aws sso login commands, the credentials are not stored in a local credentials file. Instead, AWS SDK retrieve temporary credentials from AWS SSO and store them in memory. To use the AWS SDK for C++ with AWS SSO, you need to configure the SDK to use the AWS SSO credentials provider, such as Aws::Auth::STSAssumeRoleWebIdentityCredentialsProvider, instead of the DefaultAWSCredentialsProviderChain. The DefaultAWSCredentialsProviderChain checks for credentials in environment variables, the AWS credentials file, ECS container credentials,EC2 Instance Profile credentials,etc. but it does not include AWS SSO as a credential source. When using aws configure without AWS SSO, it generates the ~/.aws/credentials file, and the DefaultAWSCredentialsProviderChain can find and use the credentials from this file. The key difference is that when using AWS SSO, the temporary credentials are not stored in a file but are dynamically retrieved and refreshed by the SDK, requiring the use of the appropriate AWS SSO credentials provider, like Aws::Auth::STSAssumeRoleWebIdentityCredentialsProvider. For more detailed information you can go through this Thanks |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hello @KreedM,
Thank you for bringing this issue to our attention.
The solution you are providing is indeed not the right one.
After investigating the issue, I can confirm that the root cause lies in the SSOCredentialsProvider.cpp file within the AWS SDK for C++. Specifically, the new configuration is being applied independently without considering any previously set high-level configurations, which is causing the authentication failure.
We acknowledge this issue and are looking into it. However, in the meantime, I would like to suggest a workaround that you can implement.
The workaround involves subclassing the SSOCredentialsProvider and customizing it according to your specific requirem…