# Acces Token With .Net Core Api

**URL:** <https://community.auth0.com/t/acces-token-with-net-core-api/11821>\
**Category:** Get Help\
**Created:** [May 24, 2018, 4:18pm UTC](https://community.auth0.com/t/acces-token-with-net-core-api/11821 "2018-05-24T16:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaullo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jaullo](https://community.auth0.com/u/jaullo)\
**Post date:** [May 24, 2018, 4:18pm UTC](https://community.auth0.com/t/acces-token-with-net-core-api/11821/1 "2018-05-24T16:18:57Z")

</div>

Hello to all.

I’m working with .net core 2.0 web api and web application.

My web application has been configured to login/logut using oauth. It works ok, i can loggin, view my claims, view my access token and token id but i need to consume some methods from my api

So we tried to access our api metod, for example: [http://localhost:21366/api/values](http://localhost:21366/api/values)  
passing in header the KEY=Authorization with Value=Bearer acces\_token

But we always receive the following error:

IOException: IDX10804: Unable to retrieve document from: 'https:///.well-known/openid-configuration&#x2

In our api we have this config:

> public void ConfigureServices(IServiceCollection services)  
> {  
> string domain = $“https://{Configuration[“Auth0:Domain”]}/”;
> 
> ```
> services.AddAuthentication(options =>
> {
> options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
> options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
> }).AddJwtBearer(options =>
> {
> options.Authority = domain;
> options.Audience = Configuration["Auth0:ApiIdentifier"];
> options.RequireHttpsMetadata = false;
>             
> options.TokenValidationParameters = new TokenValidationParameters
> {
> RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/roles"
> };
> });
> 
> services.AddMvc();
> }
> 
> ```

Any idea? What i’m doing wrong?

Thank u so much

---

<div class="post-metadata">

**Author:** ![sgmeyer](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgmeyer/32/3387_2.png) [@sgmeyer](https://community.auth0.com/u/sgmeyer)\
**Post date:** [May 24, 2018, 7:49pm UTC](https://community.auth0.com/t/acces-token-with-net-core-api/11821/2 "2018-05-24T19:49:39Z")

</div>

@jaullo I am not 100% familiar with this middleware so I’ll answer generally first and maybe I can find a more specific answer to follow.

When you send an `access_token` to your API the middleware is trying to hit a `.well-known` endpoint. This endpoint is a directory for certain information the API needs to know to validate the token. Particularly it wants to know where Auth0 is hosting the JWKS endpoint, which is used to communicate the appropriate public key necessary to validate the JWT. Given the error message it seems you’ve not configured the auth0 domain.

I see `Authority` configured which seems right. By chance chave you piped out wht domain string? Is it possible that configuration is returning an empty string?

Basically, it is really strange to see it is trying to find the directory here: `https:///.well-known/openid-configuration` instead of `https://your_tenant.auth0.com/.well-known/openid-configuration`

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 25, 2019, 1:19pm UTC](https://community.auth0.com/t/acces-token-with-net-core-api/11821/3 "2019-07-25T13:19:54Z")

</div>


