AuthBot icon indicating copy to clipboard operation
AuthBot copied to clipboard

After connect COSMOS DB, AuthBot is not working C#

Open xiaolangxyz opened this issue 6 years ago • 0 comments

I'm trying to connect COSMOS DB. It works. But after that, Auth bot is not working. It keeps telling me "Please click to sign in". When I click, I can get the number which is used to paste it back to my chat to complete the authentication. This is my code.

protected void Application_Start() {

       GlobalConfiguration.Configure(WebApiConfig.Register);
       
       AuthBot.Models.AuthSettings.Mode = ConfigurationManager.AppSettings["ActiveDirectory.Mode"];
       AuthBot.Models.AuthSettings.EndpointUrl = ConfigurationManager.AppSettings["ActiveDirectory.EndpointUrl"];
       AuthBot.Models.AuthSettings.Tenant = ConfigurationManager.AppSettings["ActiveDirectory.Tenant"];
       AuthBot.Models.AuthSettings.RedirectUrl = ConfigurationManager.AppSettings["ActiveDirectory.RedirectUrl"];
       AuthBot.Models.AuthSettings.ClientId = ConfigurationManager.AppSettings["ActiveDirectory.ClientId"];
       AuthBot.Models.AuthSettings.ClientSecret = ConfigurationManager.AppSettings["ActiveDirectory.ClientSecret"];

        //CosmosDB
       var uri = new Uri(ConfigurationManager.AppSettings["DocumentDbUrl"]);
       var key = ConfigurationManager.AppSettings["DocumentDbKey"];
       var store = new DocumentDbBotDataStore(uri, key);
       
       Conversation.UpdateContainer(
                   builder =>
                   {
                       builder.Register(c => store)
                           .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
                           .AsSelf()
                           .SingleInstance();
       
                       builder.Register(c => new CachingBotDataStore(store, CachingBotDataStoreConsistencyPolicy.ETagBasedConsistency))
                           .As<IBotDataStore<BotData>>()
                           .AsSelf()
                           .InstancePerLifetimeScope();
       
                   });

    }

xiaolangxyz avatar Jul 04 '18 09:07 xiaolangxyz