Skip to content

johnnyreilly/auth0-react-typescript-asp-net-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auth0-react-typescript-asp-net-core

A boilerplate illustrating Auth0 usage with a React / TypeScript client and an ASP.Net Server.

Getting Started

You'll need node, yarn and ASP.NET Core 2 installed.

To install the Client (ClientApp) dependencies use yarn install To install the Server (Web) dependencies use dotnet restore

Auth0 Setup

Here's how to get the app set up with Auth0; you're going to need to sign up for a (free) Auth0 account. Then login into Auth0 and go to the management portal.

Client

  • Create a Client with the name of your choice and use the Single Page Web Applications template.
  • From the new Client Settings page take the Domain and Client ID and update the similarly named properties in the appsettings.Development.json and appsettings.Production.json files with these settings.
  • To the Allowed Callback URLs setting add the URLs: http://localhost:3000/callback,http://localhost:5000/callback - the first of these faciliates running in Debug mode, the second in Production mode. If you were to deploy this you'd need to add other callback URLs in here too.

API

  • Create an API with the name of your choice (I recommend the same as the Client to avoid confusion), an identifier which can be anything you like; I like to use the URL of my app but it's your call.
  • From the new API Settings page take the Identifier and update the Audience property in the appsettings.Development.json and appsettings.Production.json files with that value.

Running in Production

Build the client app with yarn build in the ClientApp folder. Then, in the Web folder dotnet run and open your browser to http://localhost:5000

Debugging

Run the client app using webpack-dev-server using yarn start in the ClientApp folder. Fire up VS Code in the root of the repo and hit F5 to debug the server. Then open your browser to http://localhost:3000

About

A boilerplate illustrating Auth0 usage with a React / TypeScript client and an ASP.Net Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published