microsoftgraph/msgraph-sdk-java-auth

Need sample ClientCredentialProvider in microsoft-graph

nshowkath opened this issue · 1 comments

Hi ,

Our App registered in Azure & we have CLIENT_ID, SCOPES, CLIENT_SECRET, TENANT_GUID, NATIONAL_CLOUD
While implementing below usecase .
Question1
The class is missing ClientCredentialProvider in microsoft-graph
Do we need create ClientCredentialProvider ,if yes please provide sample for oAuth

public class ClientCredentialProvider implements IAuthenticationProvider
or
else are we missing any dependency ?

Details
I am trying to use Graph API to know availability of meeting rooms ,creating meeting room on our org cloud active directory . I am referring below articles as per our auth scenario
https://docs.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=Java#ClientCredentialsProvider
ClientCredentialProvider authProvider = new ClientCredentialProvider(
clientId,
scopes,
clientSecret,
tenant,
endpoint);

IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

I have added below dependencies

com.microsoft.graph microsoft-graph 1.6.0 pom com.microsoft.graph microsoft-graph 1.2.0

Question2
if "CLIENT_ID, SCOPES, CLIENT_SECRET, TENANT_GUID, NATIONAL_CLOUD" authentication details expires or changed
What is best practice to store these details to avoid redeployment
For example Config file or Admin screen (UI) to store in DB instead of hard-coding in java code ?

Regards,
Showkath.