how to get Azure Active Directory B2C working with Bot Framework?

后端 未结 2 1303
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 09:01

so far I\'ve not been able to get this working with the bot framework. I spent all day but only managed to get .net api example (https://github.com/AzureAD/azure-activedirec

2条回答
  •  离开以前
    2020-12-03 09:29

    You might want to take a look to the Facebook Auth sample to get an idea of a potential flow for the Auth scenario. For Azure AD, you need to do a similar flow.

    Let's say your user send a "Login" message to your bot. The bot should respond with an auth URL and ask the user to login to the service using that URL. You can use the GetAuthorizationRequestURL method of ADAL for that.

    Then you will have a Web API which will basically expose an endpoint that will be the reply URL of Azure AD. Once the users completes the login, a message will be posted to your Web API where you will be able to get the authorization code and perform the calls to get the Access Token. After that, you can just do the same they are doing in the Facebook Sample Web API which involves resuming the conversation with the Bot, sending a message with the access token (so it can be persisted in the PerUserInConversationData bag (check this line of code).

    After that you have the access token available to perform any call that requires an access token.

    Update

    There are two new samples that you might want to take a look since they are implementing the workflow being discussed.

    • GraphBot from the BotBuilder repo.
    • AuthBot from Mat Velloso

    Hope this helps.

提交回复
热议问题