Skip to content

Commit

Permalink
Fixed security token issue (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
SSangHoon authored Dec 14, 2022
1 parent 82923c6 commit 08ab873
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions shared_aws_api/lib/src/protocol/_sign.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ void signAws4HmacSha256({
rq.headers['Host'] = rq.url.host;
rq.headers['x-amz-content-sha256'] ??=
sha256.convert(rq.bodyBytes).toString();

if (credentials.sessionToken != null) {
rq.headers['X-Amz-Security-Token'] = credentials.sessionToken!;
}
// sorted list of key:value header entries
final canonicalHeaders = rq.headers.keys
.map((key) => '${key.toLowerCase()}:${rq.headers[key]!.trim()}')
Expand Down Expand Up @@ -61,9 +63,6 @@ void signAws4HmacSha256({
});
final signature =
Hmac(sha256, signingKey).convert(utf8.encode(toSign)).toString();
if (credentials.sessionToken != null) {
rq.headers['X-Amz-Security-Token'] = credentials.sessionToken!;
}

final auth = '$_aws4HmacSha256 '
'Credential=${credentials.accessKey}/${credentialList.join('/')}, '
Expand Down

0 comments on commit 08ab873

Please sign in to comment.