Adding User Authentication to a Simple ASP.NET Application With Akamai Identity Cloud

August 6, 2020 · by Ajay Mishra ·

This blog is part of a series that walks through user authentication using Akamai Identity Cloud in various languages. 

In this blog, we will add user authentication to a simple ASP.NET web application with Akamai Identity Cloud. The primary use case is user registration and log in or out from a simple ASP.NET application. In this example, we will use the OpenID Connect (OIDC) Authorization Code flow built into Akamai Identity Cloud as illustrated below.

You can complete the login life cycle for a simple ASP.NET web app in just five steps.

Step 1. Gather Your Details

Gather your details from the Akamai Identity Cloud console, where the following are the arbitrary values:

Required Artifacts

Arbitrary Values


Authorization Endpoint 

UserInfo Endpoint

Customer ID


Client Secret




Step 2. Configure ASP.NET to Use Akamai Identity Cloud

Here you need to set up all the artifacts as shown below. Simply create ASP.NET-based razor file index.cshtml and define the constants to put all the values that we gathered in Step 1.

web pagecode block

Step 3. Trigger Authentication

Let’s trigger the authorization endpoint to have a login link for the ASP.NET application. This code will be executed in same file of index.cshtml.

code block

A sign-in link is triggered:

sign in

Pressing the sign-in button will bring up Akamai’s pre-built hosted login page:


At this point, you can register a Generic User (John Doe) as follows:

  • Complete the display name, email address, desired password, and confirm the password


  • Now John Doe is registered and displayed


The login process is just as simple:

  • Insert user name and password


  • John Doe is registered and displayed


After registration or login, users are redirected to a “welcome.cshtml” page where authentication transpires:

  • Exchanging access token with authorization code

code block

  • Using that access token to access user information from OIDC user info endpoint

code block

Step 4. Display User Information

Here, user information is fetched and displayed by calling the OIDC user info endpoint.


5. Logout

As shown above, you can logout from the ASP.NET application by pressing the "Logout" link. The link button is backed by the logout URL, resulting in the following pop-up:


For more coding examples of ASP.NET with OIDC visit:

You Might Also Like