https://github.com/fusionauth/fusionauth-example-asp-netcore
An ASP.NET Core web application using FusionAuth as the identity server
https://github.com/fusionauth/fusionauth-example-asp-netcore
Last synced: about 1 year ago
JSON representation
An ASP.NET Core web application using FusionAuth as the identity server
- Host: GitHub
- URL: https://github.com/fusionauth/fusionauth-example-asp-netcore
- Owner: FusionAuth
- License: apache-2.0
- Created: 2020-04-30T17:18:58.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T05:54:34.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T16:56:42.400Z (about 1 year ago)
- Language: C#
- Size: 667 KB
- Stars: 2
- Watchers: 11
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Example ASP.NET Core web application
An ASP.NET Core web application using FusionAuth as the identity server.
This application will use an OAuth Authorization Code workflow to log users in.
You need to have dotnetcore installed to run this code. Please note that this application uses netcore 3.1.
Set up FusionAuth as documented in the blog post.
## Windows Install
To deploy and run on Windows, assuming you have the dotnetcore 3.1 runtime installed:
* Open up a terminal (these instructions assume a `cmd` window)
* `cd SampleApp`
* Update `appsettings.json` with the FusionAuth application `ClientId` and the `Authority` as necessary.
* Export the client secret as an environment variable: `set SampleApp__ClientSecret="..."`
* Publish the binary: `dotnet publish -r win-x64`
* Run the application: `bin\Debug\netcoreapp3.1\win-x64\publish\SampleApp.exe`
Visit the local webserver at `http://localhost:5000/` and sign in.
## Mac Install
To run on a macos, use the [scripts here](https://dotnet.microsoft.com/download/dotnet-core/scripts) to install dotnetcore.
* `cd SampleApp`
* Update `appsettings.json` with the FusionAuth application `ClientId` and the `Authority` as necessary.
* `export SampleApp__ClientSecret="..."`
* `dotnet publish -r osx.10.14-x64`
* `bin/Debug/netcoreapp3.1/osx.10.14-x64/publish/SampleApp`
Visit the local webserver at `http://localhost:5000/` and sign in.
## Misc
See more deployment options: https://docs.microsoft.com/en-us/dotnet/core/deploying/
See the blog post for more details about this code: [Securing an ASP.NET Core Razor Pages app with OAuth](https://fusionauth.io/blog/2020/05/06/securing-asp-netcore-razor-pages-app-with-oauth)
We also have [a dotnetcore5 example application](https://github.com/FusionAuth/fusionauth-example-asp-netcore5).