8000 Add temporary credentials support for put object? · Issue #41 · xtyxtyx/minio-dart · GitHub
[go: up one dir, main page]

Skip to content

Add temporary credentials support for put object? #41

Open

Description

@kaede31416

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.

Activity

  1. Boris-Plato commented on May 3, 2023

    @Boris-Plato

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

  2. zawazawagh commented on May 5, 2023

    @zawazawagh

    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?

  3. Boris-Plato commented on May 5, 2023

    @Boris-Plato

    @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

  4. zawazawagh commented on May 5, 2023

    @zawazawagh

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

  5. arrrrny commented on Oct 22, 2026

    @arrrrny

    This one is stale — the x-amz-security-token header was added upstream in
    commit 28a2e2f (2022-05-10), after this issue was opened, and it is signed
    as part of the request. You can see it in the trace with enableTrace: true:

    x-amz-security-token: your-session-token
    

    The fork keeps that behaviour and adds the credentials provider callback on
    top (see #94), so temporary credentials can also be renewed.

  6. arrrrny commented on Oct 22, 2026

    @arrrrny

    This ships in zuraffa_minio — the maintained fork of this package, which upstream has not touched since August 2025.

    The fork keeps the API of the original package unchanged, so moving over is an import swap:

    // before
    import 'package:minio/minio.dart';
    // after
    import 'package:zuraffa_minio/minio.dart';

    Source, the changelog and the sweep of the open issues of this tracker: https://github.com/arrrrny/zuraffa_minio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0