ASP.NET (OWIN): Migrating to OWIN 4
This tutorial demonstrates how to migrate from OWIN 3.x to OWIN 4.0 We recommend that you log in to follow this quickstart with examples configured for your account.
Previously, Auth0 maintained a NuGet package with OWIN middleware which developers could use to integrate Auth0 into the ASP.NET (OWIN) applications. With the move to OWIN 4, the built-in OpenID Connect middleware was re-evaluated, and the decision was made to instead use this middleware as opposed to the custom Auth0 middleware.
It is suggested that existing customers migrate their OWIN 3.x applications from OWIN 4.0 and replace the Auth0 middleware with the OpenID Connect middleware on which the new quickstart is based.
To upgrade from OWIN 3.x using the Auth0 middleware to OWIN 4 using the OpenID Connect middleware, you can follow these steps:
-
Upgrade all the OWIN related NuGet packages in your project to version 4.1.0.
-
Add a reference to the
Microsoft.Owin.Security.OpenIdConnectNuGet package. -
Remove the existing reference to the
Auth0-ASPNET-OwinNuGet package which contains the previous OWIN 3.x based middleware. -
Update your
Startup.csfile to add the following namespaces:using Microsoft.IdentityModel.Protocols.OpenIdConnect; using Microsoft.IdentityModel.Tokens; using Microsoft.Owin.Security.OpenIdConnect;Was this helpful?
/ -
Also, remove the reference to the
Auth0.Owinnamespace from yourStartup.csfile. -
Remove the registration of the previously used Auth0 OWIN middleware from the
Configurationmethod of yourStartupclass. -
Follow the steps in the OWIN Login Quickstart to register the OpenID Connect middleware in your
Startupclass.