Aufy.FluentEmail 1.0.0-beta.8

This is a prerelease version of Aufy.FluentEmail.
dotnet add package Aufy.FluentEmail --version 1.0.0-beta.8                
NuGet\Install-Package Aufy.FluentEmail -Version 1.0.0-beta.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aufy.FluentEmail" Version="1.0.0-beta.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Aufy.FluentEmail --version 1.0.0-beta.8                
#r "nuget: Aufy.FluentEmail, 1.0.0-beta.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Aufy.FluentEmail as a Cake Addin
#addin nuget:?package=Aufy.FluentEmail&version=1.0.0-beta.8&prerelease

// Install Aufy.FluentEmail as a Cake Tool
#tool nuget:?package=Aufy.FluentEmail&version=1.0.0-beta.8&prerelease                

Aufy

<p align="center"> <img src="icon.png" alt="Logo" width="100" height="100"> </p>

<p align="center"> <strong>Simple, Open-Source User Authentication for ASP.NET Core</strong> </p>

🚀 Features

  • ✅ Ready-to-use API endpoints
  • 🔐 JWT bearer authentication with refresh tokens
  • 🌐 Social logins (Discord and GitHub configured in templates)
  • 📧 Email/password sign up with confirmation
  • 🔑 Password change and reset functionality
  • 🖥️ Sample client applications - Aufy starters
    • React
    • Vue.js
    • Angular
  • 📨 Email sending abstraction for confirmations and password resets
  • 📬 FluentEmail integration with customizable templates
  • 🛠️ Customizable sign-up endpoints
  • 📚 OpenAPI/Swagger support with customization options

📖 Documentation

For detailed documentation and usage instructions, visit our official documentation site:

https://aufy.dev

🚀 Quick Start

Go to Aufy starters repository.

You can fork the repository or download the starter you want to use. Starter repository is a template repository, so you can create a new repository from it. Find a Use this template button on the repository page and choose a Create a new repository option.

Create new repository

Follow the instructions to create a new repository on your GitHub account.

Clone the repository

Clone the created repository to your local machine.

Install the .NET SDK.

Make sure you have the .NET SDK 8.0 installed on your machine. You can download it from the official website.

Open the chosen ASP.NET Core solution in the editor of your choice.

Go to src directory and find the starter you want to use. Each starter has its own solution file WebApp.[STARTER TYPE].sln.

[!CAUTION] src/WebApi directory contains multiple projects depending on the starter you choose. I recommend to remove all projects except the one you want to use.

If you want to keep multiple projects, the ef database command needs to specify the project file.

If src/WebApi directory contains one project:

Open the command line in the src/WebApi folder and run the following command to create a new Sqlite database and apply migrations.

dotnet ef database update

If src/WebApi directory contains multiple projects:

Open the command line in the src folder and run the following command to create a new Sqlite database and apply migrations.

dotnet ef database update -p ./WebApi/WebApi.[STARTER TYPE].csproj -s ./WebApi/WebApi.[STARTER TYPE].csproj

If operation completed successfully, you should see the new app.db file in the src/WebApi folder.

Configure JWT Bearer authentication.

Open the appsettings.json file in the src/WebApi folder and configure the JwtBearer section.

  "Aufy": {
    "JwtBearer": {
      "SigningKey": "xxx",
      "Issuer": "[Your Issuer]",
      "Audience": "[Your Audience]",
    }
}

Change the Issuer and Audience values to your own.

Next, go to the secret.json that is already set in the WebApi project file. You can change the name, but it's not necessary. From Visual Studio, right-click on the WebApi project and choose Manage User Secrets. Create new repository

Provide a secret value for the SigningKey property, that will be used for signing JWT tokens on your local development environment.

{
  "Aufy:JwtBearer:SigningKey": "[At lest 256 bits long key]"
}

[!CAUTION] You should never commit the value of SigningKey to the repository. It should be kept secret.

More about managing secrets in ASP.NET Core can be found here

Configure dev certificates.

WebApi and Client projects are configured to use HTTPS. To run the application locally, you need to trust the development certificates.

Windows

For windows, you can run the following command in the command line to trust the development certificates.

dotnet dev-certs https --trust

This will allow to run the WebApi project with HTTPS.

The certificate for Client project will be automatically created when you run the project.

Linux

As linux doesn't support the --trust flag, you need to manually trust the development certificates for web browsers.

You can follow the instruction on the stackoverflow. This will allow to run the WebApi project with HTTPS.

Unfortunately, the certificate for Client project will not be automatically created when you run the project. For some reason it doesn't work out of the box like on Windows.

You can create it manually by running the following command:

dotnet dev-certs https --format pem -ep /home/[YOUR_LOCAL_USER_DIR]/.aspnet/https/aufy.client.pem --no-password

[!IMPORTANT] At this point, you should have a working starter with email/password flow. Email confirmation is turned off. All emails are saved to the file system in the Development environment in the src/WebApi/logs/emails folder.

To enable social logins follow this documentation.

Configure social logins.

Starters come with Discord and GitHub social logins pre-configured, but you need to provide your own client IDs and secrets.

TODO - tutorial on create Discord and GitHub apps.

Callback urls for Discord and GitHub are on localhost:

  • Discord: https://localhost:7050/api/auth/external/callback/discord
  • GitHub: https://localhost:7050/api/auth/external/callback/github

The api/auth/ is default prefix for auth endpoints. If you change it, you should also change the callback urls.

Once you got your client IDs and secrets, open secrets.json file in the WebApi project and add the following configuration:

{
  "Aufy:Providers:GitHub:ClientId": "[Your GitHub client ID]",
  "Aufy:Providers:GitHub:ClientSecret": "[Your GitHub client secret]",
  
  "Aufy:Providers:Discord:ClientId": "[Your Discord client ID]",
  "Aufy:Providers:Discord:ClientSecret": "[Your Discord client secret]"
} 

Run the WebApi project.

WebApi comes with two pre-configured launch profiles:

  • WebApiWithClient - runs the WebApi project and the Client project using SPA Proxy.
  • WebApi - runs only the WebApi project. You need to run the Client project separately with npm run dev command.

📸 Aufy Starters Screenshots

Sign In Sign Up Forgot Password My Account My Account with Password

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta.8 42 10/9/2024
1.0.0-beta.7 55 7/13/2024
1.0.0-beta.6 56 6/14/2024
1.0.0-beta.5 60 6/1/2024
1.0.0-beta.4 60 5/21/2024