put in fixed error in appsetting.cs does not have other key
This commit is contained in:
@@ -24,9 +24,18 @@ services.AddEndpointsApiExplorer();
|
||||
services.AddSwaggerGen();
|
||||
|
||||
var appSettingsSection = builder.Configuration.GetSection("AppSettings");
|
||||
services.Configure<AppSettings>(appSettingsSection);
|
||||
var appSettings = appSettingsSection.Get<AppSettings>();
|
||||
var key = Encoding.ASCII.GetBytes(appSettings.Secret);
|
||||
string skey = "";
|
||||
if (appSettingsSection == null)
|
||||
{
|
||||
skey = builder.Configuration.GetValue<string>("AppSettings:SecretKey");
|
||||
}
|
||||
else
|
||||
{
|
||||
services.Configure<AppSettings>(appSettingsSection);
|
||||
var appSettings = appSettingsSection.Get<AppSettings>();
|
||||
skey = appSettings.Secret;
|
||||
}
|
||||
var key = Encoding.ASCII.GetBytes(skey);
|
||||
|
||||
services.AddAuthentication(x =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user