@@ -52,13 +52,13 @@ public static IServiceCollection AddSqlAppTokenCache(this IServiceCollection ser
5252 {
5353 // Uncomment the following lines to create the database. In production scenarios, the database
5454 // will most probably be already present.
55- /*
55+ /*
5656 var tokenCacheDbContextBuilder = new DbContextOptionsBuilder<TokenCacheDbContext>();
5757 tokenCacheDbContextBuilder.UseSqlServer(sqlTokenCacheOptions.SqlConnectionString);
5858
5959 var tokenCacheDbContextForCreation = new TokenCacheDbContext(tokenCacheDbContextBuilder.Options);
6060 tokenCacheDbContextForCreation.Database.EnsureCreated();
61- */
61+ */
6262 services . AddDataProtection ( ) ;
6363
6464 services . AddDbContext < TokenCacheDbContext > ( options =>
@@ -84,13 +84,18 @@ public static IServiceCollection AddSqlPerUserTokenCache(this IServiceCollection
8484 {
8585 // Uncomment the following lines to create the database. In production scenarios, the database
8686 // will most probably be already present.
87- //var tokenCacheDbContextBuilder = new DbContextOptionsBuilder<TokenCacheDbContext>();
88- //tokenCacheDbContextBuilder.UseSqlServer(sqlTokenCacheOptions.SqlConnectionString);
87+ /*
88+ var tokenCacheDbContextBuilder = new DbContextOptionsBuilder<TokenCacheDbContext>();
89+ tokenCacheDbContextBuilder.UseSqlServer(sqlTokenCacheOptions.SqlConnectionString);
8990
90- //var tokenCacheDbContextForCreation = new TokenCacheDbContext(tokenCacheDbContextBuilder.Options);
91- //tokenCacheDbContextForCreation.Database.EnsureCreated();
91+ var tokenCacheDbContextForCreation = new TokenCacheDbContext(tokenCacheDbContextBuilder.Options);
92+ tokenCacheDbContextForCreation.Database.EnsureCreated();
93+ */
9294
93- services . AddDataProtection ( ) ;
95+ // To share protected payloads among apps, configure SetApplicationName in each app with the same value.
96+ // https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-2.2#setapplicationname
97+ services . AddDataProtection ( )
98+ . SetApplicationName ( "WebApp_Tutorial" ) ;
9499
95100 services . AddDbContext < TokenCacheDbContext > ( options =>
96101 options . UseSqlServer ( sqlTokenCacheOptions . SqlConnectionString ) ) ;
0 commit comments