Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

After connect COSMOS DB, AuthBot is not working C# #49

Open
xiaolangxyz opened this issue Jul 4, 2018 · 0 comments
Open

After connect COSMOS DB, AuthBot is not working C# #49

xiaolangxyz opened this issue Jul 4, 2018 · 0 comments

Comments

@xiaolangxyz
Copy link

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();
       
                   });

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

No branches or pull requests

1 participant