0
votes

Problem Statement

Am using MS Botframework V4 (c#) using Directline channel over MS Web Chat. Have successfully integrated with Azure Active directory and am successfully able to authenticate/ login using an Azure AD account from the MS Web Chat widget.

Unfortunately the Logged in User Name is not available in stepContext.Context.Activity.From.Name property.

Other Details

following are the values of other properties when debugged using MS Bot framework Emulator:
stepContext.Context.Activity.ChannelId : "emulator"
stepContext.Context.Activity.CallerId : "urn:botframework:azure"
stepContext.Context.Activity.From.Name : "User"
stepContext.Context.Activity.From.Role : "User"
stepContext.Context.Activity.TextFormat : "plain"
stepContext.Context.Activity.Recipient.Name : "Bot"

Visual Walk Through

Sign-In Button from OAuthPrompt dialog

Sign-In Button from OAuthPrompt dialog

Shows Active Directory Sign-In Dialog

Shows Active Directory Sign-In Dialog

Six Digit OTP/Token to copy and Paste as ChatBot input

6 Digit OTP/Token to copy and Paste as ChatBot input

Incorrect User Name after Successful Sign-in

Incorrect User Name after Successful Sign-in

Client Side Web Chat / Direct Line code

Client Side Web Chat / Direct Line code

MS Bot Framework Code printing the Logged-in User Name

MS Bot Framework Code printing the Logged-in User Name

Query

Would appreciate if someone could help with getting the Logged-In user name after successfully logging-in using the Azure Active Directory credentials over MS Web chat using Direct Line channel.

1

1 Answers

2
votes

Found the solution after some Research and Patience

Used the following code which worked after providing it mentioned Graph API permission on Active Directory OAuth Helper Class used Graph API to Get Logged-in User Name and Password.

It worked seamlessly. Be a little patient after granting mentioned Graph API permissions as, it takes a little while for it to get propagated / Applied