Branch: master
Find file History
laura-rodriguez - Update Okta.AspNet packages.
- Use OktaDefaults
- Change OIDC app label by Sample.
Latest commit 2054dfb Sep 17, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
okta-aspnet-mvc-example - Update Okta.AspNet packages. Sep 17, 2018 Minor changes based on PR review. Jul 31, 2018
okta-aspnet-mvc-example.sln MVC working project. Jul 25, 2018

ASP.NET MVC & Okta-Hosted Login Page Example

This example shows you how to use the Okta.AspNet library to log in a user. The user's browser is first redirected to the Okta-hosted login page. After the user authenticates, they are redirected back to your application. ASP.NET MVC automatically populates HttpContext.User with the information Okta sends back about the user.


Before running this sample, you will need the following:

  • An Okta Developer Account, you can sign up for one at
  • An Okta Application, configured for Web mode. This is done from the Okta Developer Console and you can find instructions here. When following the wizard, use the default properties. They are designed to work with our sample applications.

Running This Example

Clone this repo and replace the okta configuration placeholders in the Web.Config with your configuration values from the Okta Developer Console. You can see all the available configuration options in the okta-aspnet GitHub. For step-by-step instructions, visit the Okta ASP.NET MVC quickstart. The quickstart will guide you through adding Okta login to your ASP.NET application.

Now start your server and navigate to http://localhost:8080 in your browser.

If you see a home page that allows you to login, then things are working! Clicking the Log in link will redirect you to the Okta hosted sign-in page.

You can login with the same account that you created when signing up for your Developer Org, or you can use a known username and password from your Okta Directory.

Note: If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console. You may want to use an incognito tab to test the flow from a blank slate.