Giter Site home page Giter Site logo

InvalidTokenId error when using Accesskey and SecretAccessKey returned from the response of AssumeRoleWithCertificate. about minio HOT 6 CLOSED

haylch avatar haylch commented on June 22, 2024
InvalidTokenId error when using Accesskey and SecretAccessKey returned from the response of AssumeRoleWithCertificate.

from minio.

Comments (6)

harshavardhana avatar harshavardhana commented on June 22, 2024

MinioClient minioClientConn = MinioClient.builder()
.endpoint(endpoint_url)
.credentials(accessKeyId, secretAccessKey)
.httpClient(okHttpClient)
.build();

You have to pass sessionToken as well

from minio.

harshavardhana avatar harshavardhana commented on June 22, 2024

Also, please either open a discussion or a GitHub issue—don't do both. Please do not spam everywhere.

from minio.

haylch avatar haylch commented on June 22, 2024

How do I pass a sessionToken to it using minio java? The .credentials in MinioClient.builder() only accepts accessKeyId and secretAccessKey. Do you have an sample code on it for the connection?

from minio.

harshavardhana avatar harshavardhana commented on June 22, 2024

https://minio-java.min.io/io/minio/credentials/Credentials.html#Credentials-java.lang.String-java.lang.String-java.lang.String-io.minio.messages.ResponseDate-

and then this https://minio-java.min.io/io/minio/MinioClient.Builder.html#credentialsProvider-io.minio.credentials.Provider-

from minio.

haylch avatar haylch commented on June 22, 2024

Thanks for your help. I got it working but I wonder if it is the correct or proper way to connect?

//Get credentials from AssumeRoleWithCertificate using CertificateIdentityProvider
Provider certIdentityProvider = new CertificateIdentityProvider(endpoint_url, sslSocketFactory, x509TrustManager, null, null);
Credentials credentials = certIdentityProvider.fetch();

//Use credentials from AssumeRoleWithCertificate to connect using StaticProvider
String accessKeyId = credentials.accessKey();
String secretAccessKey = credentials.secretKey();
String sessionToken = credentials.sessionToken();
Provider staticProvider = new StaticProvider(accessKeyId, secretAccessKey, sessionToken);

MinioClient minioClientConn = MinioClient.builder()
.endpoint(endpoint_url)
.credentialsProvider(staticProvider)
.httpClient(okHttpClient)
.build();

from minio.

harshavardhana avatar harshavardhana commented on June 22, 2024

//Get credentials from AssumeRoleWithCertificate using CertificateIdentityProvider
Provider certIdentityProvider = new CertificateIdentityProvider(endpoint_url, sslSocketFactory, x509TrustManager, null, null);

MinioClient minioClientConn = MinioClient.builder()
.endpoint(endpoint_url)
.credentialsProvider(certIdentityProvider)
.httpClient(okHttpClient)
.build();

from minio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.