Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

[Linked Account] fix bad request after link #3540

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task<IActionResult> LinkedAccounts(bool companionApp = false)
// as coming from this web-site and protecting against scenarios where a URL is shared with someone else
string trustedOrigin = $"{this.HttpContext.Request.Scheme}://{this.HttpContext.Request.Host}";

var userId = "dl_" + Guid.NewGuid().ToString();
var userId = UserId.GetUserId(this.HttpContext, this.User);
request.Content = new StringContent(
JsonConvert.SerializeObject(new
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ public async Task<TokenStatus[]> GetTokenStatusAsync(string userId, ICredentialP
new Claim(AuthenticationConstants.AudienceClaim, botAppId),
}));

// Add BotIdentity
context.TurnState.Add<IIdentity>("BotIdentity", new ClaimsIdentity(new List<Claim>
{
new Claim(AuthenticationConstants.AppIdClaim, botAppId),
new Claim(AuthenticationConstants.AudienceClaim, botAppId),
}));

// Retrieve the Token Status
tokenStatuses = await adapter.GetTokenStatusAsync(context, userId);
}
Expand All @@ -77,7 +70,13 @@ public async Task<string> GetSignInLinkAsync(string userId, ICredentialProvider
var botAppPassword = ((ConfigurationCredentialProvider)credentialProvider).Password;

string link = null;
using (var context = new TurnContext(adapter, new Microsoft.Bot.Schema.Activity { }))
using (var context = new TurnContext(adapter, new Microsoft.Bot.Schema.Activity
{
From = new ChannelAccount()
{
Id = userId
}
}))
{
var connectorClient = new ConnectorClient(new Uri(TokenServiceUrl), botAppId, botAppPassword);
context.TurnState.Add<IConnectorClient>(connectorClient);
Expand Down