Giter Site home page Giter Site logo

okta-aspnet-mvc-example's Introduction

ASP.NET MVC + Okta

This example shows how to use Okta, OpenID Connect, and ASP.NET MVC 4.x+.

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

Prerequisites: Visual Studio and Windows.

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 https://github.com/oktadeveloper/okta-aspnet-mvc-example.git

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 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:

http://localhost:8080/

Change the Login redirect URI to:

http://localhost:8080/authorization-code/callback

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

Check Implicit (Hybrid) and Allow ID Token. Add a Logout redirect URI:

http://localhost:8080/Account/PostLogout

Note: You can run the project in Visual Studio to see the port it is assigned on your machine. It may be different than 8080. In that case, you'll need to update the URIs in Okta.

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

Open the Web.config file and update these values:

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

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

Start the application

Use Visual Studio to run the project. It should start up on http://localhost:8080. (If it doesn't, update the URLs in Okta and in Web.config)

Links

Help

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

License

Apache 2.0, see LICENSE.

okta-aspnet-mvc-example's People

Contributors

nbarbettini avatar raphaellondner-okta avatar laura-rodriguez avatar sguryev avatar

Watchers

James Cloos avatar Satish Yeole avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.