Skip to content
Sample project demonstrating user authentication and identity with Angular, Asp.Net Core and IdentityServer4
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update packages to resolve vulnerabilities. May 11, 2019
LICENSE Initial commit Mar 12, 2019
README.md Update README.md Apr 5, 2019

README.md

AngularASPNETCoreOAuth

Sample project based on the blog post demonstrating how to build out an Implicit Grant OAuth flow utilizing OAuth2/OpenID Connect protocols implementing IdentityServer4 as our OpenID Connect Provider and then using it to authenticate an Angular SPA client to authorize access to an independent ASP.NET Core Web API.

Development Environment

  • Visual Studio 2019 Community
  • Visual Studio Code 1.32.3
  • .NET Core SDK 2.2.104
  • Angular 7.2.9
  • IdentityServer4 2.4.0
  • SQL Server Express 2016 LocalDB

Setup

To run the demo:

1. Clone/Fork/Download this repository.

2. Create the database on your SQL Server Express LocalDB by using the dotnet cli to run the migrations from within the AuthServer.Infrastrucuture project folder.

AuthServer.Infrastructure> dotnet ef database update --context AppIdentityDbContext
AuthServer.Infrastructure> dotnet ef database update --context PersistedGrantDbContext

3. Install Angular CLI if necessary. npm install -g @angular/cli

4. Install Angular SPA dependencies.

Spa\oauth-client> npm install

5. Run the Angular CLI dev server to build and run the Angular app.

Spa\oauth-client> ng serve

6. Build/Run the AuthServer.sln solution using your preferred method: Visual Studio, VSCode, dotnet CLI.

7. Build/Run the Resource.Api.sln solution using your preferred method: Visual Studio, VSCode, dotnet CLI.

8. Point a browser to http://localhost:4200 to access the Angular client.

9. Use the Signup and Login functions to perform the authentication flow, then try and access the Top Secret Area to hit the protected ASP.NET Core Web API.

Contact

mark@fullstackmark.com

You can’t perform that action at this time.