Shaddix.OpenIddict.ExternalAuthentication
2.10.6
dotnet add package Shaddix.OpenIddict.ExternalAuthentication --version 2.10.6
NuGet\Install-Package Shaddix.OpenIddict.ExternalAuthentication -Version 2.10.6
<PackageReference Include="Shaddix.OpenIddict.ExternalAuthentication" Version="2.10.6" />
<PackageVersion Include="Shaddix.OpenIddict.ExternalAuthentication" Version="2.10.6" />
<PackageReference Include="Shaddix.OpenIddict.ExternalAuthentication" />
paket add Shaddix.OpenIddict.ExternalAuthentication --version 2.10.6
#r "nuget: Shaddix.OpenIddict.ExternalAuthentication, 2.10.6"
#:package Shaddix.OpenIddict.ExternalAuthentication@2.10.6
#addin nuget:?package=Shaddix.OpenIddict.ExternalAuthentication&version=2.10.6
#tool nuget:?package=Shaddix.OpenIddict.ExternalAuthentication&version=2.10.6
OpenIddictExternalAuthentication
Library that simplifies integration of OpenIdDict to a several lines of code.
It contain basic implementation of AuthenticationController, mostly taken from OpenIddict Samples.
What's inside
- Required endpoints to support 3rd party authentication (e.g. Google, Facebook, etc.)
- JWT access_token/refresh_token generation (i.e. default
/connect/tokenendpoint) - Refresh token flow
- Authorization Code flow
- Resource Owner Password Flow (disabled by default, could be enabled via configuration)
EnableIdentityServerRefreshTokens()option that eases the migration from IdentityServer (i.e., that RefreshTokens from IdentityServer will still work, ifPersistedGrantstable remains)app.UseOpenIdDictConversionMiddleware()helps to support old clients when migrating from IdentityServer. It allows to do the following:- Remove non-existing scopes
- Remove header authorization (if client_id/client_secret are passed in Form parameters)
- Remove client_secret for public clients (otherwise OpenIdDict complains)
- Change name of form parameters (e.g.
userName→username)
Here's the vanilla js or react demo of Google/Facebook authentication using OpenIddict on backend.
The page has several buttons to log in via different providers.
How to
PREREQUISITE: it's implied, that openiddict is installed and configured in your project already (if it's not, head over to one of the samples).
Install nuget to add the library to your project.
dotnet add package Shaddix.OpenIddict.ExternalAuthenticationCreate you own
AuthorizationControllerby inheriting fromOpenIdAuthorizationControllerBase. This could look like:public class AuthorizationController : OpenIdAuthorizationControllerBase<IdentityUser, string> { public AuthorizationController(SignInManager<IdentityUser> signInManager, UserManager<IdentityUser> userManager, IOpenIddictClientConfigurationProvider clientConfigurationProvider) : base(signInManager, userManager, clientConfigurationProvider) { } }Override some functions (e.g.
CreateNewUserorGetClaims) if you want to customize user creation behavior or provide more claims.From
Configurefunction inStartup.csadd the following calls (in addition to standard OpenIddict setup):services .AddOpenIddict() .AddOpenIddictConfigurations(Configuration) .AddDefaultAuthorizationController()You could customize default authorization controller configuration (or even default OpenIddict configuration) by doing:
.AddDefaultAuthorizationController(options => options.DisableRefreshTokenFlow())or
.AddDefaultAuthorizationController(options => options.OpenIddictServerBuilder.AllowNoneFlow())Add external auth providers (i.e.
.AddAuthentication().AddGoogle(),.AddFacebook(), etc.). Follow instructions on how to set up applications on OAuth provider side.
You could also take a look at OpenIddictExternalAuthentication.Example for example usage (keep in mind, that there are hardcoded ClientId/ClientSecret for FB and Google within Example app. They are for demo purposes and everyone can use them, so beware).
Frontend
- Use some proven openid client library (I personally recommend oidc-client-ts).
- Use standard auth code flow according to the library instructions, pointing to standard Authorize endpoint and passing
?provider=Googleas a query parameter (i.e. authorization endpoint should look like/connect/authorize?provider=Google). - You could check example implementation in plain-js or React
External user storage
We use standard Asp.Net Identity mechanism to store external logins (namely, AspNetUserLogins table). To find a user by external OAuth id you need to use _userManager.FindByLoginAsync(providerName, externalUserId)
FAQ
- Error in browser: "The specified 'redirect_uri' is not valid for this client application."
- Check
OpenIddictApplicationstable and verify thatRedirectUrisfield contains the URI you are redirecting to. - If URI is not there, check
RedirectUrisinappsettings.jsonfor the respective application. - If problematic URI is a relative one, make sure that you called
options.SetPublicUrl()with correct URL inAddDefaultAuthorizationControllerconfiguration callback.
- Check
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. |
-
net6.0
- IdentityModel (>= 6.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.0)
- Microsoft.Extensions.Identity.Core (>= 7.0.0)
- Microsoft.Extensions.Identity.Stores (>= 7.0.0)
- OpenIddict.AspNetCore (>= 6.1.1)
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 |
|---|---|---|
| 2.10.6 | 142 | 12/25/2025 |
| 2.10.5 | 224 | 9/8/2025 |
| 2.10.4 | 490 | 9/3/2025 |
| 2.10.3 | 258 | 9/2/2025 |
| 2.10.2 | 207 | 9/2/2025 |
| 2.10.1 | 200 | 9/2/2025 |
| 2.9.3 | 6,638 | 6/24/2025 |
| 2.9.2 | 179 | 6/20/2025 |
| 2.9.1 | 175 | 6/20/2025 |
| 2.8.3 | 3,011 | 6/18/2025 |
| 2.8.2 | 3,051 | 3/4/2025 |
| 2.8.1 | 232 | 3/3/2025 |
| 2.7.1 | 1,181 | 11/8/2024 |
| 2.6.9 | 15,101 | 3/6/2024 |
| 2.6.8 | 11,999 | 12/24/2023 |
| 2.6.7 | 212 | 12/24/2023 |
| 2.6.6 | 4,628 | 5/2/2023 |
| 2.6.5 | 271 | 5/2/2023 |
| 2.6.4 | 453 | 5/2/2023 |
| 2.6.3 | 256 | 5/2/2023 |
| 2.6.2 | 257 | 5/2/2023 |
| 2.6.1 | 261 | 5/2/2023 |
| 2.5.1 | 277 | 5/1/2023 |
| 2.4.3 | 9,053 | 12/23/2022 |
| 2.4.2 | 2,663 | 12/17/2022 |
| 2.4.1 | 405 | 12/17/2022 |
| 2.3.2 | 1,879 | 10/24/2022 |
| 2.3.1 | 2,369 | 8/15/2022 |
| 2.2.2 | 2,373 | 7/23/2022 |
| 2.2.1 | 655 | 7/20/2022 |
| 2.1.3 | 935 | 7/8/2022 |
| 2.1.2 | 556 | 7/7/2022 |
| 2.1.1 | 583 | 7/6/2022 |
| 2.0.3 | 1,182 | 6/21/2022 |
| 2.0.2 | 616 | 6/20/2022 |
| 2.0.1 | 532 | 6/20/2022 |
| 1.4.5 | 601 | 6/20/2022 |
| 1.4.4 | 533 | 6/20/2022 |
| 1.4.3 | 562 | 6/20/2022 |
| 1.4.2 | 553 | 6/19/2022 |
| 1.4.1 | 565 | 6/19/2022 |
| 1.3.2 | 564 | 6/18/2022 |
| 1.3.1 | 574 | 6/17/2022 |
| 1.2.3 | 630 | 6/9/2022 |
| 1.2.2 | 532 | 6/9/2022 |
| 1.2.1 | 566 | 6/8/2022 |
| 1.1.4 | 566 | 5/29/2022 |
| 1.1.3 | 1,124 | 5/5/2022 |
| 1.1.2 | 1,344 | 3/14/2022 |
| 1.0.5 | 572 | 3/14/2022 |
| 1.0.4 | 597 | 3/13/2022 |
| 1.0.2 | 574 | 3/13/2022 |
| 1.0.1 | 558 | 3/13/2022 |