Created
August 10, 2020 13:20
-
-
Save chadmichel/b68fc357dc99321e91663d09199c1c40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllers(); | |
var key = Encoding.ASCII.GetBytes("YOUR_KEY"); | |
services.AddAuthentication(x => | |
{ | |
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; | |
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; | |
}) | |
.AddJwtBearer(x => | |
{ | |
x.TokenValidationParameters = new TokenValidationParameters | |
{ | |
IssuerSigningKey = new SymmetricSecurityKey(key), | |
ValidateIssuer = false, | |
ValidateAudience = false, | |
ValidIssuer = "localhost", | |
ValidAudience = "localhost" | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment