Skip to content

okta-samples/okta-dotnetcore3-api-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Core 3.x API Quickstart Sample Code for Integrating with Okta

This repository contains a sample of protecting API endpoints using Okta in a .NET Core Web API.

The sample uses the Okta.AspNetCore Nuget package. Read more about getting started with Okta and authentication best practices on the Okta Developer Portal.

This code sample demonstrates

  • Configuring Okta
  • Protecting routes
  • Reading claims values

Getting started

You will need the .NET Core 3.1 SDK.

To run this example, run the following commands:

git clone https://github.com/okta-samples/okta-dotnetcore3-api-quickstart.git
cd okta-dotnetcore3-api-quickstart

Restore the Nuget packages.

Create an OIDC application in Okta

Create a free developer account with the following command using the Okta CLI:

okta register

You will need your Okta domain and Audience.

Update appsettings.json with your Okta settings adding Okta as a top level property.

"Okta": {
  "OktaDomain": "https://{yourOktaDomain}",
  "AuthorizationServerId": "default",
  "Audience": "api://default"
}

Start the app by running in the IDE.

Use your favorite HTTP Client to call the API. For authenticated calls, follow the steps in Send a request to your API endpoint using Postman of the quick start.

Helpful resources

Help

Please visit our Okta Developer Forums.

Releases

No releases published

Packages

No packages published

Languages