How to get Authenticated User Email address through Azure Ad , I am using bot framework , C# and for authentication i am using AuthBot .
@msftgits @msgits2 @matvelloso please help !
I got the email address of the user but didn't know how to get the other fields from azure active directory like department name , job title , etc. @matvelloso @msftdata @msftgits please provide me a way.
Hello MassLuis, Even I am facing the similar issue.. is there any way to get Tenant User info data like Department Name, Job Title etc. Thanks in advance. @matvelloso @msftdata @msftgits
Hi guys, the access token that gets created as a result of the login process can be used with the Microsoft Graph API - https://graph.microsoft.io/ . You can get info like that straight from the graph if you create an authenticated graph client after calling the IBotContext.GetAccessToken extension method in AuthBot.
See the following for more info on working with the Graph API, https://github.com/Azure-Samples/active-directory-dotnet-graphapi-web
Sorry for my delay in replying, I'm in the middle of a trip.
Essentially you have two ways of grabbing this data:
1-From the ID token itself: You will see that when the authbot authenticates, it gets a token. If you grab the data between the first "." and the last "." and Base64 decode it, you will get a JSON that we call JWT token. In there you will see some basic info about e-mail, etc. But it may not have everything you want. The benefit is that you need no additional calls
2-Like mentioned above, you request another access token for Microsoft Graph, which will let you make any calls, ask who manages who, job title, etc. When I manage to get some time I'll publish an example of each