Requesting MS Graph Access Token registered in Azure Active Directory RRS feed

  • Question

  • I was trying to retrieve the MS Graph access token which is registered in Azure Active Directory by using the following parameters (client-id,client-secret,resource,authority).I would like to provide the code snipnet mentioned below:

     ClientCredentialProvider clientCredential = new ClientCredentialProvider()
                    authority = "https://login.microsoftonline.com/xxxx",
                    client_id = "xxxx",
                    client_secret = "xxxx",
                    resource = "https://graph.microsoft.com"
    var credential = new ClientCredential(clientCredential.client_id, clientCredential.client_secret);
     AuthenticationContext authenticationContext = new AuthenticationContext(clientCredential.authority);
     var token = authenticationContext.AcquireTokenAsync(clientCredential.resource, credential);
     Console.WriteLine("Token:", token);

    Tuesday, October 15, 2019 10:07 PM


All replies