In this blog post we will try to see what kind of user information we can access using Microsoft.IdentityModel.Clients.ActiveDirectory library. In the last post we saw how we can get access token from a native application.
If you are using Active Directory client library to generate an access token for different client application you should be aware about what kind of client data you can access except the one that your application access it.
The UserInfo property of AuthentificationResult object. Using this property we can access the following user information:
In this moment this is all that you can access. No EMAIL, PHONE or other informations.
If you are using Active Directory client library to generate an access token for different client application you should be aware about what kind of client data you can access except the one that your application access it.
AuthenticationContext authenticationContext =
new AuthenticationContext(_loginUrl);
AuthenticationResult result = authenticationContext.AcquireToken(
"https://outlook.office365.com/", //This is resource id for Exchange Server from Office 365
"clientID",
new Uri("http://localhost/"));
string myCoolToken = result.AccessToken;
From the start you should know that you cannot access user password. Once you get the authentication result object that contains the token itself, you will be able to access some user details from that object.The UserInfo property of AuthentificationResult object. Using this property we can access the following user information:
- Family Name
- Given Name
In this moment this is all that you can access. No EMAIL, PHONE or other informations.
Comments
Post a Comment