Use OpenID Connect for Authorization in Your ASP.NET MVC Framework 4.x App

Use OpenID Connect for Authorization in Your ASP.NET MVC Framework 4.x App

This is a quick tutorial demonstrating how to add authorization to an ASP.NET MVC Application using OpenID Connect and Okta.


how do I go about changing the the… example to use a login page in the app instead of redirecting out of it


You can create your own login page. In that case, look at using the Okta SDK for .NET and making the login calls yourself with the SDK. Feel free to drop me questions at


This is an excellent post! Perhaps the old github project at… can be retired or linked to this one? I found the older one first and struggled to get it to work.

Umair Khan

can someone please share the link for OIDC implementation for Google not OKTA

Matthew O.

This is a little confusing as some of the recommended things do not appear in the source code. One example is the http://localhost:8080/authorization-code/callback, which doesn’t seem to be a valid path on the site. Another one is the part where you’re talking about mapping the openid connect groups to roles. Can we get clarification?


The post has been updated. It turns out the sample app that you clone at the beginning had changed.


The authorization-code/callback url is one that is used by the Okta .NET SDK which comes with the sample.

Hope this helps.

Sandeep Tamma

Great article. Hoping to see similar example with using okta sdk.

During development I observed SQL exception and after a bit of online research I’ve found that we need to add <rolemanager enabled=“false”/> above </system.web> in the web.config to make this work. The reason seems in Machine config file this key set to true by default and that will cause issue.

Bhavya Khanna

Need help to implement authorization code grant flow with OKta in existing application.


Is it possible to load the settings on an event and customize the app builder to use the settings