我怎麼能要求用戶從機器人登錄到我的網站,以及稍後當用戶要求bot首先檢查用戶是否在我的網站進行身份驗證,如果不是重定向到web登錄。我已經在bot中使用登錄卡進行了登錄,並且我傳遞了activity.user.id,但是如果用戶登錄或不登錄,我不知道如何檢索信息。微博殭屍框架,如何驗證用戶登錄網絡應用程序
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity reply = activity.CreateReply($"Well hello there. What can I do for you today?");
await connector.Conversations.ReplyToActivityAsync(reply);
var id = activity.From.Id;
reply.Attachments = new List<Attachment>();
List<CardAction> cardButtons = new List<CardAction>();
CardAction plButton = new CardAction()
{
Value = $"http://myapp.azurewebsites.net/Account/Login?userid='{id}'",
Type = "signin",
Title = "Connect"
};
cardButtons.Add(plButton);
SigninCard plCard = new SigninCard("You need to authorize me", new List<CardAction>()
{ plButton });
Attachment plAttachment = plCard.ToAttachment();
reply.Attachments.Add(plAttachment);
var replyt = await connector.Conversations.SendToConversationAsync(reply);
我試過這個,但是當我試圖讓機器人數據通過GetPrivateConversationDataAsync它總是返回null。 –
檢查您實際設置令牌的位置。它是PrivateConversationData/UserData嗎? – Satheesh