Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,19 +826,25 @@ public virtual async Task<string> GetOauthSignInLinkAsync(ITurnContext turnConte
throw new ArgumentNullException(nameof(userId));
}

var appId = GetBotAppId(turnContext);
var activity = turnContext.Activity;

if (!userId.Equals(activity.From?.Id))
{
throw new ArgumentException("cannot retrieve OAuth signin link for a user that's different from the conversation");
}

var appId = GetBotAppId(turnContext);
var tokenExchangeState = new TokenExchangeState()
{
ConnectionName = connectionName,
Conversation = new ConversationReference()
{
ActivityId = null,
Bot = new ChannelAccount { Role = "bot" },
ChannelId = Channels.Directline,
Conversation = new ConversationAccount(),
ServiceUrl = null,
User = new ChannelAccount { Role = "user", Id = userId, },
ActivityId = activity.Id,
Bot = activity.Recipient, // Activity is from the user to the bot
ChannelId = activity.ChannelId,
Conversation = activity.Conversation,
ServiceUrl = activity.ServiceUrl,
User = activity.From,
},
MsAppId = appId,
};
Expand Down