minio-dart
minio-dart copied to clipboard
Info: MinioS3Error MinioError: The security token included in the request is invalid
I think my sessionToken is free of exceptions, and I have verified it in the sdk of the other end
What I use is fputObject()
Add a line to minio_uploader.dart
add_stream
function:
if (!client.enableSHA256) {
md5digest = md5.convert(chunk).bytes;
headers['Content-MD5'] = base64.encode(md5digest);
}
headers['x-amz-security-token'] = minio.sessionToken ?? ''; // add this line
Don't know why the author didn't add x-amz-security-tokey
to the headers. @doralines
I've added @serious198706 answer to my fork (conditionally) if anyone needs it...
Future addStream(Stream<Uint8List> stream) async {
await for (var chunk in stream) {
List<int>? md5digest;
final headers = <String, String>{};
headers.addAll(metadata);
headers['Content-Length'] = chunk.length.toString();
if (!client.enableSHA256) {
md5digest = md5.convert(chunk).bytes;
headers['Content-MD5'] = base64.encode(md5digest);
}
if (minio.sessionToken != null) {
headers['x-amz-security-token'] = minio.sessionToken; // add this line
}
minio: git: url: https://github.com/jpetro416/minio-dart
Resolved, please update to v3.5.1