msgraph-sdk-java icon indicating copy to clipboard operation
msgraph-sdk-java copied to clipboard

Version 6.4.0: Cannot get configured certificate(s) for an application

Open vipetrov-bg opened this issue 1 year ago • 0 comments

Expected behavior

Have at least one configured certificate

Perform request Application app= graphClient.applications().byApplicationId(applicationId).get(); as app.getKeyCredentials().get(0).getKey() is null!

Actual behavior

The app.getKeyCredentials().get(0).getKey() should not be null, expected certificate in byte format.

Steps to reproduce the behavior

TokenCredential tokenCredential = new ClientCertificateCredentialBuilder().tenantId(tenantId)
.clientId(clientId).pfxCertificate(pfxCertificatePath).clientCertificatePassword(pfxPassword)
.build();

String[] scopes = new String[] { "https://graph.microsoft.com/.default" };

GraphServiceClient graphClient = new GraphServiceClient(tokenCredential, scopes);

// Have at least one configured certificate for "<my app id>"
Application app = graphClient.applications().byApplicationId("<my app id>").get();

List<KeyCredential> keyCredentialList = app.getKeyCredentials();

keyCredentialList.get(0).getKey() is null!

The other properties are OK.

vipetrov-bg avatar Mar 08 '24 13:03 vipetrov-bg