ASP.NET Core 2.0 MVC + Okta example
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
OktaAspNetCoreMvc Finish cleaning up appsettings Jun 7, 2018
.gitignore Check in launchSettings Oct 3, 2017
LICENSE Create LICENSE Sep 7, 2017
OktaAspNetCoreMvc.sln Create project Sep 7, 2017 Clean up readme Jun 7, 2018

ASP.NET Core 2.0 MVC + Okta

This example shows how to use Okta, OpenID Connect, and ASP.NET Core 2.0 MVC.

You can follow the quickstart for this project to see how it was created.

Prerequisites: .NET Core 2.0 or higher.

Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage and secure users and roles in any application.

Getting started

To install this example application, clone this repository with Git:

git clone
cd okta-aspnetcore-mvc-example

Or download a zip archive of the repository from GitHub and extract it on your machine.

Create an application in Okta

You will need to create an application in Okta to to perform authentication.

Log in to your Okta Developer account (or sign up if you don't have an account) and navigate to Applications > Add Application. Click Web, click Next, and give the app a name you'll remember.

Change the Base URI to:


Change the Login redirect URI to:


Click Done. On the General Settings screen, click Edit.

Add a Logout redirect URI:


Scroll to the bottom of the Okta application page to find the client ID and client secret. You'll need those values in the next step.

Project configuration

Update the appsettings.json file with these values:

  • Okta:ClientId - The client ID of the Okta application
  • Okta:ClientSecret - The client secret of the Okta application
  • Okta:Issuer - Replace {yourOktaDomain} with your Okta domain, found at the top-right of the the Dashboard page

Optionally, if you want to use the Okta SDK (and test Account/Me) make sure to update these values as well:

  • Okta:APIToken - Your API token obtained from the API section of the Developer Console
  • Okta:OrgUrl - Replace {yourOktaDomain} with your Okta domain, found at the top-right of the Dashboard page

Note: The value of {yourOktaDomain} should be something like Make sure you don't include -admin in the value!

Start the application

Run the project with Visual Studio, or with this command:

dotnet run

Browse to http://localhost:60611 to test the application.



Please post any questions on the Okta Developer Forums. You can also email if you would like to create a support ticket.


Apache 2.0, see LICENSE.