Authy.AspNetCore
0.1.11-beta
This is a prerelease version of Authy.AspNetCore.
dotnet add package Authy.AspNetCore --version 0.1.11-beta
NuGet\Install-Package Authy.AspNetCore -Version 0.1.11-beta
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="Authy.AspNetCore" Version="0.1.11-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Authy.AspNetCore" Version="0.1.11-beta" />
<PackageReference Include="Authy.AspNetCore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Authy.AspNetCore --version 0.1.11-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Authy.AspNetCore, 0.1.11-beta"
#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.
#:package Authy.AspNetCore@0.1.11-beta
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Authy.AspNetCore&version=0.1.11-beta&prerelease
#tool nuget:?package=Authy.AspNetCore&version=0.1.11-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Authy.AspNetCore
Authy.AspNetCore makes it easy for developers to replace the existing TOTP algorithm in asp.net core with Authy.
Authy.AspNetCore is in beta and you may encounter bugs. This project is subject to breaking changes.
Quick Start
Using Authy.AspNetCore is easy. There are several "tricks" used that allow you to use Authy.AspNetCore without requiring any database migrations.
Add authy to your application (Note: If you are using a custom DBContext or IdentityUser class, replace them as needed)
services.AddDefaultIdentity<ApplicationUser>(options => {
options.Tokens.AuthenticatorTokenProvider = AuthyBuilder.AUTHY_TOKEN_PROVIDER_NAME;
}).AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddAuthy2FA<ApplicationUser>();
services.AddAuthy(new AuthyCredentials("YOUR AUTHY API KEY HERE"));
services.AddHttpClient();
Note: This replaces the existing TOTP algorithm. We may readd the existing TOTP algorithm
Now that you have added Authy.AspNetCore you can create a user as follows (you should verify that the user was created)
//Note: IAuthyCall2FA is registered with DI
private readonly IAuthyCall2FA _authy;
public async Task<IActionResult> OnPostAsync()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
if (!ModelState.IsValid)
{
return Page();
}
var authyUser = new AuthyUser
{
CountryCode = CountryCode,
PhoneNumber = PhoneNumber,
Email = user.Email
};
var code = await _authy.RegisterUserAsync(authyUser, _userManager, user);
return RedirectToPage("./EnableAuthenticator");
return Page();
}
You should not need to modify LoginWith2fa at all unless you want to use Authy OneTouch
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Microsoft.Extensions.Http (>= 3.1.7)
- Microsoft.Extensions.Identity.Core (>= 3.1.7)
- Microsoft.Extensions.Identity.Stores (>= 3.1.7)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 4.7.2)
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 | |
|---|---|---|---|
| 0.1.11-beta | 550 | 8/29/2020 | |
| 0.1.10-beta | 411 | 8/24/2020 | |
| 0.1.9-beta | 424 | 8/24/2020 | |
| 0.1.8-beta | 657 | 8/22/2020 | |
| 0.1.7-beta | 657 | 8/22/2020 | |
| 0.1.6-beta | 662 | 8/22/2020 | |
| 0.1.5-beta | 661 | 8/22/2020 | |
| 0.1.4-beta | 674 | 8/22/2020 | |
| 0.1.3-beta | 635 | 8/22/2020 | |
| 0.1.2-beta | 734 | 8/21/2020 | |
| 0.1.1-beta | 646 | 8/21/2020 | |
| 0.1.0-beta | 891 | 8/21/2020 |