An example of a simple SPA app with an API backend that uses authentication.
This demo integrates the latest changes to identity management in ASP.NET Core, specifically the new endpoints and token-based authentication. It also demonstrates the HTTP editor for API interactions directly within Visual Studio.
To keep up with the .NET team, check out our team blog.
For my latest astrophotography see DeepSkyWorkflows.
All images are (c) 2023 by me, Jeremy Likness, and are available for use with attribution. You have my explicit permission to download and use them for non-commercial use, including in personal screen savers and desktop backgrounds.
The repo contains the SQLite database pre-populated so you should be able to build and run it "out of the box.".
If you need to rebuild the database for any reason, run the included deepskies
and it will regenerate the database. For example, you may want to update
the login scenario to use your own email address and password.
Copy the gallery.sqlite3
file somewhere and reference it in applicationsettings.json
.
- Make sure login
div
is hidden withstyle="display:none"
and collapsed in the UI - The
index.html
page is first - The
gallery.js
app is next, scrolled to theinit
method at the bottom - The
Program.cs
is open with the auth pieces hidden (highlight,CTRL+M CTRL+H
) - The
DeepSkyData.cs
is open with the typed tasks showing - The
DeepSkyPersonalData.cs
file is open - Always restart the app between demos to clear the in-memory identity database
- Navigate to "developer tools (F12)" then "Application" and "Storage" to click "Clear site data" to get rid of cookies
- Show the app running
- Filter on galaxies
- Filter on nebulae
- Click on an item that has coordinates
- Explain some of the details and the "celestial address"
- Tap on the link to show on the Microsoft Research World Wide Telescope
- Open dev tools (F12) and click on network
- Clear the filters and show the request
- Open the
gallery.js
file and scroll to theinit
method to show the fetch requests - Open the
Program.cs
file and show the configuration, explain how endpoints can be grouped - Open the
DeepSkyData.cs
file and show the typed tasks - Navigate up to the mapping
- Show syntax highlighting for routes
- Show code completion for constraints
- Show analyzer
- Explain how the endpoint explorer helps navigate APIs in your project
- Show the .http file and make some example requests
- Explain the observation location and privacy concerns
- Remove "display:none" from the login
div
- Show the login screen
- Show failed attempt at observation location
- Explain that registration isn't built yet in the UI but can easily be done with the API
- Run the API to register
- Show problem details explaining password policy
- Add '!' and register
- In the app, login with the wrong password
- Login with the correct password
- On M13-florissant show the observation link
- Show the call failing in the .http file
- Explain why we supported tokens for clients like mobile or even Visual Studio
- Use the login in the .http file to get a token
- Paste the token into the
@accessToken
variable - Now run the observation link and show it returns a link you can cut and paste to navigate to