msgraph-sdk-java
msgraph-sdk-java copied to clipboard
Version 6.4.0: Cannot get configured certificate(s) for an application
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.