From 8cf8efa2a49a9dd827715469514340b9a847a23e Mon Sep 17 00:00:00 2001 From: "runxc1(Bret Ferrier)" Date: Sat, 13 May 2023 00:43:08 +1000 Subject: [PATCH] Add Facebook to the list of supported providers --- .../OpenIddictClientWebIntegrationHandlers.cs | 12 +++++++- ...penIddictClientWebIntegrationProviders.xml | 28 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index bc484d53..544facdd 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -518,10 +518,20 @@ public static partial class OpenIddictClientWebIntegrationHandlers Debug.Assert(context.UserinfoRequest is not null, SR.GetResourceString(SR.ID4008)); + // Facebook limits the number of fields returned by the userinfo endpoint + // but allows returning additional information using special parameters that + // determine what fields will be returned as part of the userinfo response. + if (context.Registration.ProviderName is Providers.Facebook) + { + var options = context.Registration.GetFacebookOptions(); + + context.UserinfoRequest["fields"] = string.Join(",", options.Fields); + } + // By default, LinkedIn returns all the basic fields except the profile image. // To retrieve the profile image, a projection parameter must be sent with // all the parameters that should be returned from the userinfo endpoint. - if (context.Registration.ProviderName is Providers.LinkedIn) + else if (context.Registration.ProviderName is Providers.LinkedIn) { var options = context.Registration.GetLinkedInOptions(); diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 995e60d9..8043df3d 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -191,7 +191,7 @@ As such, the Deezer integration tries to use the standard parameters and only uses the non-standard equivalents when no other option exists (e.g an "output" query string parameter must be sent to get JSON token responses). --> - + + + + + + + + + + + + + + + + + +