Can someone tell me if it will still be possible to use following authentication method with MS Graph after October 13, 2020?
public static async Task<string> GetUserAccessTokenAsync()
{
String APIToken = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX";
String LoginMail = "[email protected]";
String LoginWachtwoord = "xxxxxxxxxxx";
UserPasswordCredential userPasswordCredential = new UserPasswordCredential(LoginMail, LoginWachtwoord);
AuthenticationContext authContext = new AuthenticationContext("https://login.microsoftonline.com/diekeure.be");
//Console App for Microsoft Graph
AuthenticationResult token = await authContext.AcquireTokenAsync("https://graph.microsoft.com/", APIToken, userPasswordCredential);
return token.AccessToken;
} /* GetUserAccessTokenAsync */
public static GraphServiceClient GetAuthenticatedClient()
{
GraphServiceClient graphClient = new GraphServiceClient(
new DelegateAuthenticationProvider(
async (requestMessage) => {
string accessToken = await GetUserAccessTokenAsync();
// Append the access token to the request.
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
}));
return graphClient;
} /* GetAuthenticatedClient */
-> await graphClient....
Nuget package: Microsoft.IdentityModel.Clients.ActiveDirectory v3.19.8
I'm not really sure of this won't work either
Your sample isn't using Basic Authentication, it is using the OAuth Password grant. While not a very secure authentication mechanism (since you have to store a password), it is quite different than Basic Auth.
The email you referenced is also specific to legacy services like Exchange Web Services (EWS). Microsoft Graph is not a legacy API, it is the recommended/modern REST API for Microsoft services.