Skip to content

Instantly share code, notes, and snippets.

@gnschenker
Created December 30, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnschenker/0e83f0f51df2d9933b25045bb5334144 to your computer and use it in GitHub Desktop.
Save gnschenker/0e83f0f51df2d9933b25045bb5334144 to your computer and use it in GitHub Desktop.
Configuring Authentication via Bearer tokens
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = $"https://{Configuration["Auth0:Domain"]}/";
options.Audience = Configuration["Auth0:Audience"];
});
services.AddControllers();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment