public async Task <IActionResult> UnlinkAccountsAsync() { var userId = User.FindFirstValue(ClaimConstants.ObjectId); var tenantId = User.FindFirstValue(ClaimConstants.TenantId); await _tokenProvider.LogoutAsync(tenantId : tenantId, userId : userId); return(new StatusCodeResult((int)HttpStatusCode.NoContent)); }
private async Task <DialogTurnResult?> InterruptAsync(DialogContext innerDc, CancellationToken cancellationToken = default) { if (innerDc.Context.Activity.Type == ActivityTypes.Message) { var text = innerDc.Context.Activity.Text.ToLowerInvariant(); var userId = innerDc.Context.Activity.From.AadObjectId; var tenantId = innerDc.Context.Activity.Conversation.TenantId; // Allow logout anywhere in the command if (text.Contains("logout")) { await _oauthTokenProvider.LogoutAsync(tenantId : tenantId, userId : userId); await innerDc.Context.SendActivityAsync(MessageFactory.Text("You are now logged out"), cancellationToken : cancellationToken); return(await innerDc.CancelAllDialogsAsync(cancellationToken)); } } return(default);