OAuth 2.0 social authentication providers for ASP.NET Core
BuildChallengeUrl()
and/or ExchangeCodeAsync()
(#635) Thanks @martincostello!
FormatScope(IEnumerable<string>)
overrides (#635) Thanks @martincostello!
Full Changelog: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/compare/6.0.1...6.0.2
[LoggerMessage]
for logging (#624, #628) Thanks @martincostello!
NuGet.exe
instead of dotnet nuget
to publish packages (#630) Thanks @kevinchalet!
Full Changelog: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/compare/6.0.0...6.0.1
ConfigurationManager
in Apple provider (#421, #561) Thanks @martincostello !
Claims.AvatarUrl
from Discord provider (#584, #585) Thanks @martincostello !
public const string
members changed to public static readonly string
.Version 6.0.0 includes breaking changes from version 5.0.x for some of the providers. See below for the specific changes and how to migrate.
The PrivateKeyBytes
property was updated to accept a CancellationToken
and return a ReadOnlyMemory<char>
.
- public Func<string, Task<byte[]>>? PrivateKeyBytes { get; set; }
+ public Func<string, CancellationToken, Task<ReadOnlyMemory<char>>>? PrivateKey { get; set; }
Use the AsMemory()
extension method to change a string
to a ReadOnlyMemory<char>
.
Versions of the Discord provider before version 6.0.0
would automatically map the user's avatar URL as the urn:discord:avatar:url
claim.
This functionality is no longer built-in (see #584 and #585), but can be added to your application with some extra code similar to that shown in the sample below.
services.AddAuthentication(options => /* Auth configuration */)
.AddDiscord(options =>
{
options.ClientId = "my-client-id";
options.ClientSecret = "my-client-secret";
options.ClaimActions.MapCustomJson("urn:discord:avatar:url", user =>
string.Format(
CultureInfo.InvariantCulture,
"https://cdn.discordapp.com/avatars/{0}/{1}.{2}",
user.GetString("id"),
user.GetString("avatar"),
user.GetString("avatar").StartsWith("a_") ? "gif" : "png"));
});