我在BOT框架中启用了Cortana通道 . BOT框架通过直接通道从客户端应用程序使用 . 以下是我的工作场景: - 对于BOT框架中的几个操作,我需要通过客户端应用程序对用户进行身份验证(内部使用Owin.Oauth进行外部提供程序,如google,FB身份验证) - 然后检索访问令牌来自客户端的BOT框架,然后将其传递给我的授权服务以进行进一步的活动

  • 我也需要在 Cortana and client BOT directline 中实现这一点

  • Following are the different steps I followed:

1)CORTANA - 启用连接帐户服务但它不是我的要求,因为我总是需要强制用户在活动之前登录客户端应用程序 . 此外,Connected帐户与Cortana绑定 . 在我的场景中,用户应该登录到客户端以使用BOT功能

Connected Account

2)我在BOT Auth中检查了以下代码示例,并使用OAuth在BOT框架内进行了身份验证

BOT framework OAuth我也不想在我的BOT框架中处理身份验证

我需要的是来自客户端的Auth令牌,我可以使用它从BOT框架为同一个提供者授权我的WEB API

我尝试了以下方法,通过BOT框架从客户端获取身份验证令牌和用户身份信息,但尚未完全测试 . 我不确定cookie和其他含义

MY Client application Strtup Auth:

public void ConfigureAuth(IAppBuilder app)
    {
        // Configure the db context, user manager and signin manager to use a single instance per request
        app.CreatePerOwinContext(ApplicationDbContext.Create);
        app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
        app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

        // Enable the application to use a cookie to store information for the signed in user
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login"),
             Provider = new CookieAuthenticationProvider
            {
                 OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    validateInterval: TimeSpan.FromMinutes(20),
                    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
            }
        });
         app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

         app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
        app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

         app.UseOAuthBearerTokens(OAuthOptions);
        app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
        {
            ClientId = ConfigurationManager.AppSettings["googleclientid"],
            ClientSecret = ConfigurationManager.AppSettings["googleclientsecret"],
            Provider = new GoogleOAuth2AuthenticationProvider()

        });

是否有任何API调用可以从API使用以从客户端获取以下详细信息,因为我不知道用户登录到客户端应用程序时使用了哪个电子邮件地址

1)提供者

2)用户电子邮件地址

3)Authtoken和有效性