botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Cortana] SignCard doesn't work with Cortana, but fine with skype

Open andy51002000 opened this issue 9 years ago • 8 comments

System Information (Required)

  • SDK Language: C#
  • SDK Version: Bot Builder 3.8
  • Development Environment:

Issue Description

My connection button inside the sign-in card disappears when works with Cortana, but Skype is fine.

Code Example

            var message = activity.CreateReply();
            message.Speak = "This is a Sign-in card";
            message.Summary = "This is a Sign-in card";
            message.Text = "Message Text";
            message.Attachments = new List<Attachment>(){
            new SigninCard("You need to authorize me", new List<CardAction>()
            {
                new CardAction()
                {
                    Value = "https://xxxbot.xxxx.com.tw:8443/account/Login?id="+System.Web.HttpUtility.UrlEncode(activity.From.Id),
                    Type = "signin",
                    Title = "Connect"
                }
            }).ToAttachment()
            };

            await connector.Conversations.SendToConversationAsync(message);

Steps to Reproduce

  1. invoke cortana skill
  2. Appear sign-in card without connection button

Actual Results

failed with cirtana image

Successed with skype image

andy51002000 avatar Jun 16 '17 02:06 andy51002000

When using a SignIn card on Cortana, you need to add the 'redirect_uri' query string parameter. https://docs.microsoft.com/en-us/cortana/tutorials/bot-skills/bot-skill-auth

I added &redirect_uri=http://bing.com/agents/oauth' to my SignIn Card and it works perfectly. I am not using the redirect uri value in my OAuth login flow, but just adding it to the URL is enough to get the card working in Cortana.

iMicknl avatar Jun 16 '17 17:06 iMicknl

Here's a code example for sign-in card for .NET SDK which shows how to configure the URL with redirect_uri parameter:

var message = context.MakeMessage() as IMessageActivity;
message.Speak = "This is a Sign-in card";
message.Summary = "This is a Sign-in card";
message.Text = "Message Text";
message.Attachments = new List<Attachment>(){
    new SigninCard("You need to authorize me", new List<CardAction>()
    {
        new CardAction()
        {
            Value = "https://login.microsoftonline.com/?redirect_uri=http%3a%2f%2fbing.com%2fagents%2foauth",
            Type = "signin",
            Title = "Connect"
        }
    }).ToAttachment()
};
await context.PostAsync(message);

nwhitmont avatar Jun 19 '17 16:06 nwhitmont

I also had the problem. I already set the redirect_uri in my OAuth URL, such as: https://accounts.google.com/o/oauth2/v2/auth?client_id=xxx&redirect_uri=http%3a%2f%2azurewebsites.net/%2fapi%2fOAuthCallback

But Cortana still can't display Sign-in Card.

I don't know what happened. Please help me, thank you.

poumason avatar Jul 30 '17 07:07 poumason

I try the more sample, such as SimpleFacebookAuthBot , then the Cortana still doesn't display action button. Why?

poumason avatar Jul 31 '17 16:07 poumason

@poumason what happens if you use the snippet that @nwhitmont provided, which you can also find in the official documentation.

My guess is that the sign-in card only works when you provide the redirect URI for Cortana, https://www.bing.com/agents/oauth. I have used this successfully in the past, where adding this redirect_uri was enough to get it to work.

iMicknl avatar Jul 31 '17 16:07 iMicknl

I try to use official documentation the sample. But it is not work. I capture my debug log in the Cortana: "attachments": [ { "contentType": "application/vnd.microsoft.card.signin", "content": { "text": "", "buttons": [ { "type": "signin", "title": "Connect", "value": "https://login.microsoftonline.com/?redirect_uri=http%3a%2f%2fbing.com%2fagents%2foauth" } ] } } ],

other question: the URL https://www.bing.com/agents/oauth, Where do I should setting it? the card action of the Sign-in card or the redirect uri setting page of the OAuth website (such as Google OAuth console website)?

poumason avatar Jul 31 '17 16:07 poumason

@poumason You are commenting on a closed issue. Please open a new issue.

nwhitmont avatar Jul 31 '17 17:07 nwhitmont

Cortana Skills with Bot Framework Developer Preview does not currently support the Sign-In Card workflow on the Cortana channel.

The Cortana team is actively working on integrating this feature, with planned release of this functionality in the next few months.

nwhitmont avatar Jul 31 '17 18:07 nwhitmont