Skip to content
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

BotAuthentication problem #867

Closed
vovanb opened this issue Aug 1, 2016 · 8 comments
Closed

BotAuthentication problem #867

vovanb opened this issue Aug 1, 2016 · 8 comments
Assignees

Comments

@vovanb
Copy link

vovanb commented Aug 1, 2016

Hello, I have two question regarding BotAuthentication:
1.I created OWIN host selfservice project(windows service) which handle BOT controller located in separated C# class library.How I can pass programmatically MicrosoftAppId and MicrosoftAppPassword to dll, because by default it is looking in host exe app config and not in folder where dll placed.
2.We want to develop BOT service which will serve multiple BOTS, different by incoming laguage for example in same service - how we can load Microsoft.Bot.Connector with different credential ?
Thanks a lot.

@willportnoy
Copy link
Member

  1. You can pass parameters to BotAuthentication attribute rather than assuming the presence of an app.config:
    https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Connector/BotAuthentication.cs#L15
  2. You can have different endpoints per bot, for example.

@urmich
Copy link

urmich commented Aug 2, 2016

@vovanb In regards to bullet 2 - I had a similar problem when I developed skype calling bot. I had to implement 1 service that will be used for several bots, all of them executing the same logic but producing different experience. For this purpose, in each bot definition, I appended query string parameter to the calling URL (in your case this would be messaging URL). However, the SDK v3 did not support URL query string parameters, so I created pull request #764 to implement the support. So in your case you might consider identical aproach to add something like ?lang=EN or ?lang=FR to the messaging URL.

@vovanb
Copy link
Author

vovanb commented Aug 2, 2016

@willportnoy and @mghimp thanks for the reply. But how I can pass MicrosoftAppId and MicrosoftAppPassword in runtime, can you provide example? As soon as I know there is no way to assign attribute metadata in runtime - it is done on compilation. Also if I will have different endpoint for bot then Authentication MicrosoftAppId should be different for each bot -since it is uneq cross the framework (I got error when tried to use same MicrosoftAppId for different bot)
Thanks

@willportnoy
Copy link
Member

@vovanb you may want to search for how people create a dynamic ActionFilterAttribute - for example, you want want to create your own attribute that wraps and delegates to the framework's BotAuthentication attribute and provides the values dynamically but delegates to the inner BotAuthentication.OnActionExecutingAsync method.

@vovanb
Copy link
Author

vovanb commented Aug 2, 2016

Ok thank you, can you provide an example?

Sincerely,
Vladimir

On 2 באוג׳ 2016, at 18:56, Will Portnoy notifications@github.com wrote:

@vovanb you may want to search for how people create a dynamic ActionFilterAttribute - for example, you want want to create your own attribute that wraps and delegates to the framework's BotAuthentication attribute and provides the values dynamically but delegates to the inner BotAuthentication.OnActionExecutingAsync method.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@willportnoy
Copy link
Member

I don't have any example code handy, but you may want to look at
https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Connector/BotAuthentication.cs#L15
as a model for implementing an ActionFilterAttribute. In your implementation of ActionFilterAttribute, the post method will create an inner BotAuthentication attribute and delegate OnActionExecutingAsync to it.

@willportnoy willportnoy self-assigned this Aug 4, 2016
@willportnoy
Copy link
Member

I'm going to close this issue, but feel free to open a new issue for further discussions.

@vovanb
Copy link
Author

vovanb commented Jan 27, 2017

Method OnActionExecutingAsync removed in 3.5 version. We need urgent suggestion how to use it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants