Giter VIP home page Giter VIP logo

reactjs-ts-identityserver's Introduction

reactjs-ts-identityserver

Demo project for using Identity Server with React.js SPA and TypeScript

Demo Gif

The project is in 3 parts:

IdentityServer (http://localhost:5000)

Based off the IdentityServer4 samples, it uses uses ASP.NET Identity for identity management. You'll need to create the database (instructions bellow) to begin creating user accounts.

A single page application made with React, TypeScript and Webpack. Uses redux-oidc package for managing authentication.

Note: I'm no longer using hash router, webpack dev server is configured to redirect all pages to index.html. When deploying to production, you will need a similar mecanism for the callback page to work (this can easily be done using Netlify or Firebase hosting).

Based off the dotnet new webapi template. Has a global authorize filter.

Stuff to install

Dotnet Core 3.0 SDK
Node.js
SQL Server express

Running the project

Clone repository

Add a secrets.json file in IdentityServer folder with the following (replace user id and password):

{
    "ConnectionStrings": {
      "DefaultConnection": "Server=(local);Database=AspIdentity;MultipleActiveResultSets=true;user id=*****;password=*****;"
    }
}

Open a command prompt in project location:

cd Spa

yarn

yarn serve

In a second command prompt:

cd IdentityServer

dotnet ef database update

dotnet run

In a third command prompt:

cd Api

dotnet run

Go to identity server (http://localhost:5000) create an account then go to the single page app (http://localhost:5100)

You may need to change the environment variable on each project, either

  • run set ASPNETCORE_ENVIRONMENT=Development in Windows cmd terminal
  • run $Env:ASPNETCORE_ENVIRONMENT = "Development" in Windows powershell terminal
  • run ASPNETCORE_ENVIRONMENT=Development in Linux bash

Credits

reactjs-ts-identityserver's People

Contributors

thunderdev1 avatar dependabot[bot] avatar vidaritos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.