-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.NET SDK] During OAuth Flow For 3rd Party Auth Provider, Sign In Button Does Not Launch Website #4970
Comments
RIght now there are workarounds for this, but we have work items to deal with all of this we hope to get knocked out very soon. Try the workaround I mention in #4768: C#You will need to first add a class like this that inherits from IMessageActivityMapper: public sealed class CustomActivityMapper : IMessageActivityMapper
{
public IMessageActivity Map(IMessageActivity message)
{
if (message.ChannelId == ChannelIds.Msteams)
{
if (message.Attachments.Any() && message.Attachments[0].ContentType == "application/vnd.microsoft.card.signin")
{
var card = message.Attachments[0].Content as SigninCard;
var buttons = card.Buttons as CardAction[];
if (buttons.Any())
{
buttons[0].Type = ActionTypes.OpenUrl;
}
}
}
return message;
}
} next you will need to register that class in your builder
.RegisterType<CustomActivityMapper>()
.AsImplementedInterfaces()
.SingleInstance(); If you copy and paste the magic code in teams you will get extra characters like "\r\n123456\r" Below is a way to deal with this from #4899: In my messages controller I put a check for the magic code copy paste like this: if (activity.Type == ActivityTypes.Message)
{
if (activity.ChannelId == ChannelIds.Msteams && activity.Text.StartsWith("\r\n"))
{
activity.Text = CustomCode.SanatizeMagicCodeForTeams(activity.Text);
}
await Conversation.SendAsync(activity, () => new RootDialog());
} Then I wrote this simple static class to handle it: public static class CustomCode
{
public static string SanatizeMagicCodeForTeams(string magicCode)
{
Regex regex = new Regex(@"\r\n(\d{6})\n");
var match = regex.Match(magicCode);
if (match.Success)
{
magicCode = magicCode.Substring(2, 6);
}
return magicCode;
}
} |
@JasonSowers in the work arounds posted for the other (sms/slack) channels, I get to the sign in page, and am able to get a re-direction back to the conversation flow before it fails. In MS Teams, I can't even launch the login page, since clicking on the button does not launch a browser window. Will the work around handle this as well? Cheers, |
Sorry for the delay I was out yesterday. Yes the workaround I posted in #4897 will also take care of the issue in teams. That workaround actually takes care of like 80% of the channel specific problems with Auth. Just remember to add the correct channels to your if statement. Or always run the But you are saying the workaround in #4897 is not working for you? |
I will try the workaround tomorrow or Monday. Not sure if it works. Thanks for the response jason |
@mkonkolowicz I have a sample that has OAuth working on every channel (except email and cortana) in this repo. Feel free to use the project as a reference while we sort things out in the SDK. It's an adaption of the AADv2 Sample, but the concepts will transfer to 3rd party. |
Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo. From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos. As part of this restructuring, we are closing all tickets in this repo. For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here: For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here: For product behavior, how-to, or general understanding questions, please use Stackoverflow. Thank you. The Bot Framework Team |
Bot Info
Issue Description
During oauth flow for 3rd party oauth provider, clicking on the button which provides the login link, does not bring up a new browser window to be used for login.
Code Example
await SendOAuthCardAsync(context, (Activity)context.Activity);
Reproduction Steps
Expected Behavior
button click launches browser window that redirects to authentication entry point.
Actual Results
button click does not bring up any window.
*NOTE, upon hover over of button, there seems to be a link that exists.
The text was updated successfully, but these errors were encountered: