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

Using AssumeRoleProvider.GetCredentialsAsync to get token error report #845

Open
tangjingtai opened this issue Aug 21, 2023 · 0 comments
Open

Comments

@tangjingtai
Copy link

tangjingtai commented Aug 21, 2023

// This is the address and port that nginx listens on
// Forward to minio api address 192.168.1.203:9000
var endpoint = "192.168.1.202:9000";   // using 192.168.1.202:80 forward success
var accessKey = "xxxx";
var secretKey = "yyyyy";

using var minio = new MinioClient()
	.WithRegion("cn-north-1")
	.WithEndpoint(endpoint)
	.WithCredentials(accessKey, secretKey)
	.WithSSL(false)
	.Build();
	
var provider = new AssumeRoleProvider(minio);
var token = await provider.GetCredentialsAsync().ConfigureAwait(false);

Error:

System.NullReferenceException:“Object reference not set to an instance of an object.”
在 Minio.MinioClient.ParseErrorFromContent(ResponseResult response)
在 Minio.MinioClient.ParseError(ResponseResult response)
在 Minio.MinioClient.<>c.<.ctor>b__94_0(ResponseResult response)
在 Minio.MinioClient.HandleIfErrorResponse(ResponseResult response, IEnumerable`1 handlers, DateTime startTime)
在 Minio.MinioClient.d__143.MoveNext()
在 Minio.Credentials.AssumeRoleProvider.d__13.MoveNext()

http request:

POST http://192.168.1.202:9000/ HTTP/1.1
Accept-Encoding: identity
x-amz-content-sha256: ae8a5f5ec22398788172e69e073eeaf10d6dd90c65e314ea2058c8ffe15d647a
Host: 192.168.1.202:9000
x-amz-date: 20230821T060649Z
Authorization: AWS4-HMAC-SHA256 Credential=xkadmin/20230821/cn-north-1/sts/aws4_request, SignedHeaders=accept-encoding;content-type;host;x-amz-content-sha256;x-amz-date, Signature=894e388b507942c69522cd2f121c7939137cceb0337d453b532b0afa04e7315e
User-Agent: MinIO (Microsoft Windows 10.0.19042;X64) minio-dotnet/5.0.0.0
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: 57

Action=AssumeRole&DurationSeconds=3600&Version=2011-06-15

http response:

HTTP/1.1 403 Forbidden
Server: nginx/1.22.0
Date: Mon, 21 Aug 2023 06:06:50 GMT
Content-Type: application/xml
Content-Length: 344
Connection: keep-alive
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Bucket-Region: cn-north-1
X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
X-Amz-Request-Id: 177D50E5E00F2E20
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/"><Error><Type></Type><Code>AccessDenied</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message></Error><RequestId>177D50E5E00F2E20</RequestId></ErrorResponse>
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

1 participant