# Using okta with .net 5 in back end and react in frontend.Backend configuration issues

**URL:** <https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986>\
**Category:** Questions\
**Tags:** dotnet\
**Created:** [February 25, 2024, 4:17pm UTC](https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986 "2024-02-25T16:17:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hetal](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@Hetal](https://devforum.okta.com/u/Hetal)\
**Post date:** [February 25, 2024, 4:17pm UTC](https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986/1 "2024-02-25T16:17:49Z")

</div>

I am trying to set up configuration for okta in .net core.  
I have created a developer account. I want to use oAuth/OIDC.  
In appsettings, under domain,  
“Okta”: {  
“Domain”: “[https://dev-vnlvlqu8reyoqrcn.us.auth0.com/api/v2/](https://dev-vnlvlqu8reyoqrcn.us.auth0.com/api/v2/)”  
},  
I have used the value which was there in dashboard’s API section Auth0 Management API identifier.  
I am getting this error.  
{“IDX20803: Unable to obtain configuration from: ‘[https://dev-vnlvlqu8reyoqrcn.us.auth0.com/api/v2/oauth2/default/.well-known/openid-configuration](https://dev-vnlvlqu8reyoqrcn.us.auth0.com/api/v2/oauth2/default/.well-known/openid-configuration)’.”}|System.InvalidOperationException|  
Also, this is the code in program.cs  
services.AddAuthentication(options =\>  
{  
options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;  
options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;  
options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;  
}  
).AddOktaWebApi(new OktaWebApiOptions()  
{  
OktaDomain = Configuration[“Okta:Domain”].ToString()  
}  
Am I missing out on something?

---

<div class="post-metadata">

**Author:** ![nicole](https://avatars.discourse-cdn.com/v4/letter/n/258eb7/32.png) [@nicole](https://devforum.okta.com/u/nicole)\
**Post date:** [February 27, 2024, 3:36pm UTC](https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986/2 "2024-02-27T15:36:29Z")

</div>

Those are Auth0 domains in your configuration so I recommend reaching out in the [Auth0 Community](https://community.auth0.com/) with this question.

If you need to test with an Okta account, you can [create an Okta dev account here](https://developer.okta.com/signup/).

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [March 7, 2024, 5:16pm UTC](https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986/3 "2024-03-07T17:16:17Z")

</div>

Like @nicole mentioned, you seem to be using an Auth0 org with [Okta’s .NET MVC library](https://github.com/okta/okta-aspnet/blob/master/docs/aspnetcore-mvc.md). I’m not positive whether or not that will work (I should note that okta-aspnet is just a wrapper around OWIN and is designed to work with Okta’s OAuth implementation). You could look to use Auth0s library instead, I’m betting it will be a bit smoother sailing for you. This article looks to walk through the full set-up: [Add Login to your ASP.NET MVC application | Auth0](https://auth0.com/docs/quickstart/webapp/aspnet-core/interactive)

The main error you seem to be encountering is related to how the library attempts to hit the OIDC metadata endpoint. From what I’ve seen, this is based on a combination of [OktaDomain and AuthorizationServerId](https://github.com/okta/okta-aspnet/blob/master/docs/aspnetcore-mvc.md#configuration-reference).

I don’t know as much about Auth0/CIC’s request paths for their authorization servers, but you _could_ try setting AuthorizationServerId to string.Empty (which Okta WIC/CIS already supports). It should then try to hit the well-known endpoint by just slapping /.well-known/openid-configuration onto the end of the OtkaDomain value (which I believe you will need to remove `/api/v2`/ from), which I see does seem to be the correct metadata endpoint for your org: [https://dev-vnlvlqu8reyoqrcn.us.auth0.com/.well-known/openid-configuration](https://dev-vnlvlqu8reyoqrcn.us.auth0.com/.well-known/openid-configuration).

Like I said, not sure if this will wind up working as I haven’t tested this library with an Auth0 org before and you might wind up running into other discrepancies with assumptions made in Okta’s library, but could be worth a shot!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [April 6, 2024, 5:16pm UTC](https://devforum.okta.com/t/using-okta-with-net-5-in-back-end-and-react-in-frontend-backend-configuration-issues/26986/4 "2024-04-06T17:16:52Z")

</div>

Closed on April 6, 2024, 5:16pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
