# Auth0 configuration for Web API core 2.0

**URL:** <https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082>\
**Category:** Get Help\
**Tags:** dotnet-core, web-api\
**Created:** [September 4, 2017, 6:46pm UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082 "2017-09-04T18:46:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.ufland](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@mark.ufland](https://community.auth0.com/u/mark.ufland)\
**Post date:** [September 4, 2017, 6:46pm UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082/1 "2017-09-04T18:46:56Z")

</div>

Hi,

Microsoft have changed the way they configure a Web API in core 2.0 but the Auth0 documentation is for core 1.0. Does anyone have an example of how it should be done in core 2.0 with an asymetric key?

I assume it is something like this

```
services.AddAuthentication()
            .AddJwtBearer(cfg =>
            {
                cfg.RequireHttpsMetadata = false;
                cfg.SaveToken = true;

                cfg.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidIssuer = $"https://{Configuration"Auth0:Domain"]}/",
                    ValidAudience = Configuration"Auth0:ClientId"],
                    IssuerSigningKey = IssuerSigningKey = new AsymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration"AppSettings:Auth0ApiToken"]))
                };

            });

```

Thanks.

---

<div class="post-metadata">

**Author:** ![jerrie](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jerrie/32/5898_2.png) [@jerrie](https://community.auth0.com/u/jerrie)\
**Post date:** [September 5, 2017, 11:03am UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082/2 "2017-09-05T11:03:17Z")

</div>

Our Quickstart shows the correct way for [ASP.NET](http://ASP.NET) Core 2.0:  
[Auth0 ASP.NET Core Web API SDK Quickstarts: Authorization](https://auth0.com/docs/quickstart/backend/aspnet-core-webapi)

If you’re starting a new project from scratch, you can also give our new .NET Core templates a spin:  
[https://github.com/auth0-community/auth0-dotnet-templates](https://github.com/auth0-community/auth0-dotnet-templates)

---

<div class="post-metadata">

**Author:** ![dotan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dotan/32/7375_2.png) [@dotan](https://community.auth0.com/u/dotan)\
**Post date:** [October 22, 2017, 11:46pm UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082/3 "2017-10-22T23:46:28Z")

</div>

It still doesn’t specify how to add the API audience to the mvc app to allow access in behalf of the user…  
Help please?

---

<div class="post-metadata">

**Author:** ![jerrie](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jerrie/32/5898_2.png) [@jerrie](https://community.auth0.com/u/jerrie)\
**Post date:** [October 24, 2017, 8:42am UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082/4 "2017-10-24T08:42:22Z")

</div>

Yes, because the MVC app and the API are 2 different things. Your question was related to the API.

If you want to know how to specify the audience in the MVC app, please have a look at this section of the MVC quickstart:  
[https://auth0.com/docs/quickstart/webapp/aspnet-core/v2/01-login#obtaining-an-access-token-for-calling-an-api](https://auth0.com/docs/quickstart/webapp/aspnet-core/v2/01-login#obtaining-an-access-token-for-calling-an-api)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/auth0-configuration-for-web-api-core-2-0/8082/5 "2018-03-02T05:56:19Z")

</div>


