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

Add temporary credentials support for put object? #41

Open
kaede31416 opened this issue Apr 6, 2022 · 4 comments
Open

Add temporary credentials support for put object? #41

kaede31416 opened this issue Apr 6, 2022 · 4 comments

Comments

@kaede31416
Copy link

Seems like it can't make use of session token params when we put object, minio always return “The AWS Access Key Id you provided does not exist in our records” error.

@Boris-Plato
Copy link

More info: setting enableTrace=true I do not see X-Amz-Security-Token header in the trace.

@zawazawagh
Copy link

Hi, @Boris-Plato I'm running this simple code, but I'm having The AWS Access Key Id you provided does not exist in our records. error.

  final minioClient = Minio(
      endPoint: "s3-ap-northeast-1.amazonaws.com",
      accessKey: "my-access-key",
      secretKey: "my-secret-key",
      sessionToken: "my-session-token",
      region: "ap-northeast-1",
      enableTrace: true
  );

  @override
  void initState() {
    super.initState();
    _getBuckets();
  }

  Future<void> _getBuckets() async {
    try {
      final buckets = await minioClient.listBuckets();
      for (final bucket in buckets) {
        print('Bucket: ${bucket.name}, '
            'Created: ${bucket.creationDate}');
      }
    } catch (e) {
      print('Error: $e');
    }
  }

and the console goes like this.

An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:64707/tsZWaTtM9yk=
REQUEST: GET https://s3-ap-northeast-1.amazonaws.com/
host: s3-ap-northeast-1.amazonaws.com
user-agent: MinIO (Unknown; Unknown) minio-dart/2.0.0
x-amz-date: 20230505T133214Z
x-amz-content-sha256: UNSIGNED-PAYLOAD
authorization: AWS4-HMAC-SHA256 Credential=......./20230505/ap-northeast-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=.............


RESPONSE: 403 Forbidden
content-type: application/xml
date: Fri, 05 May 2023 13:32:13 GMT
server: AmazonS3
transfer-encoding: chunked
x-amz-id-2: ..................
x-amz-request-id: ................

Error: MinioError: The AWS Access Key Id you provided does not exist in our records.

as you said, enabletrace option shows the request headers, however I can't find X-Amz-Security-Token.

Env

  • Windows 10
  • Flutter 3.7.12
  • Dart 2.19.6
  • web browser client, windows standalond client

Is there any missing code? I'm really new to flutter and dart, so could you please give me some help?

@Boris-Plato
Copy link

@zawazawagh Hey! I think this package has a bug when it does not really send sessionToken. This error (The AWS Access Key Id you provided does not exist in our records) is certainly related to missed token - I reproduced it with Postman. I had a problem with PutObject API, but I think it could be the same with listBuckets. You can find a recent PR for a similar discussion there:
#62
You can add it to pubspec.yaml this way:

minio:
   git:
     url: "https://github.com/xtyxtyx/minio-dart"
     ref: fa47b40efa88903ef0216236d0756d336c9f683c

But it did not work in my case: getting temp credentials from inside the AWS ECS Fargate task and put object to AWS S3 bucket, so I created this fork that I'm testing on my side right now, You can try it this way:

minio:
   git:
     url: "https://github.com/Boris-Plato/minio-dart"

You can also create your own PR/fork

@zawazawagh
Copy link

@Boris-Plato Thank you for your information.
Your forked repo solved my problem! You saved my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants