Web App AppSettings - ob1dev/Auth0 GitHub Wiki

When creating Application in Auth0 Portal you copied values of the fields Domain, Client ID and Client Secret. Now this is where you need them.

Visual Studio

In the files appsettings.json and appsettings.Development.json, add the following settings using the values from your Auth0 Application.

{
  "Auth0": {
    "Domain": "olegburov.auth0.com",
    "ClientId": "vRmDy1JB5sN1j6OqyKP5obij6C4s6BcW",
    "ClientSecret": "uhPo80PC1GB3ZJsIzbO61-DDmUjb3W6BNtOZpBeSUmsthosE_9zdrz2GY73OCdTg",
    "CallbackUrl": "https://localhost:44399/signin-auth0"    
  }
}

You might want to check the file launchSettings.json under the node Properties in Visual Studio, to find out what's the host and port are when lunching the Web App.

NOTE

If running the project locally the file appsettings.Development.json is used, because of the environment variable ASPNETCORE_ENVIRONMENT=Development, which is defined in the section Debug under the project's properties.

NOTE

You can also enable the User Secret feature, which creates the file secrets.json locally. Whatever you put inside overwrites the same values in the file appsettings.json or appsettings.Development.json.

If you're going to deploy the Web App to Azure App Service as I did, most likely you need to overwrite some of the above settings with specific values for your PRODUCTION deployment.

Pay attention to the syntax for the field Name. It's {Section-Name}:{Setting-Name}. For example, if you want to overwrite the setting Domain under the section Auth0, you must put it as Auth0:Domain and then its value in a dedicated field.

Summary

Now the Web App has all Auth0 Application configuration to start using it. In the next tutorial, you'll begin looking at more advanced topics by using Authentication middleware, which will handle relation between Web App and Auth0.

What's next?

Web App - Middleware

⚠️ **GitHub.com Fallback** ⚠️