Build a REST API with ASP.NET Web API

Build a REST API with ASP.NET Web API

Learn how to build RESTful API service with ASP.NET Web API.


Nice post, but the option ‘Service’ is not available

Matt Raible

That’s probably because you’re using an Okta org that doesn’t have some developer feature flags turned on. I’d recommend you create a new org by signing up at…. You can also send an email to and ask to turn the feature flags on for OIDC.


Thanks @mattraible

Asad Ali

Nice Post. Thanks


After run it showing me parent directory if I click on controller/ListItemsController.cs not found error I am getting.

Matt Raible

Hello Nancy,

Did you figure out the problem? If not, can you post your code to a public GitHub repo so we can take a look?


Same issue Please check…


Thank you, but i have an error when i “Request Token”
"error getting access token from client_credentials flow"
Pls help me, thanks!

Dale Shadle

Well layed out. Unfortunately for me it failed after adding the controller and running it. GIves me - No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class. I do see the Owin reference out there

Jeff Ziegler

This doesn’t work for me in VS2017 using framework 4.7.2, I am getting a 403.14 on URL: http://localhost:10373/api/listitems/.


Is your URL def http and not https?


Did you name the project the same as him? If not, check the namespace of your startup class, it needs to match your project name.


How would you call just the WebApi with Okta using Postman? Would it be possible to have a stand alone WebApi Authentication/Authorization web api that any application can call and use?

Matt Raible

We have Postman Collections you can use to call our API directly.

Eddy Troy

how to add swagger document into this application



Luis Schz

Followed step by step, but keep getting “Authorization has been denied for this request.” There is only one difference I’ve found. On the instructions it says, “Now go to your ListsController.cs and add an [Authorize] attribute right above the class definition.” but nowhere in the tutorial they have us create a ListController.cs, we have created a ListItemsController and that’s where I added the [Authorize] attribute. Was I correct on adding it to the ListItemsController.cs or am I actually missing the ListController.cs? Any help is appreciated. Thanks!

Suzanne Tighe

I am having the exact same error - did you figure this out yet?

Jake Hollcroft

As soon as I added

public class ListsController : ApiController

I get this error message:

“message”: “No HTTP resource was found that matches the request URI ‘https://localhost:44347/api/listitems’.”,
“messageDetail”: “No type was found that matches the controller named ‘listitems’.”


Thanks for nice article. However when I am trying to use the same its giving me an error “proxy authentication required” at below line of code.

var discoveryDocument = Task.Run(() => configurationManager.GetConfigurationAsync()).GetAwaiter().GetResult();

Can you please suggest how to inject proxy in this?