From 23ded64f28773e6231b8e24239b33d5ce14d7cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 11 Mar 2023 20:33:41 +0100 Subject: [PATCH] Add HubSpot to the list of supported providers --- .../OpenIddictClientWebIntegrationHandlers.cs | 8 ++++++ ...penIddictClientWebIntegrationProviders.xml | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index 8011c28f..493cbc91 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -426,6 +426,14 @@ public static partial class OpenIddictClientWebIntegrationHandlers context.UserinfoEndpoint = context.Registration.ProviderName switch { + // HubSpot doesn't have a static userinfo endpoint but allows retrieving basic information + // by using an access token info endpoint that requires sending the token in the URI path. + Providers.HubSpot when + (context.BackchannelAccessToken ?? context.FrontchannelAccessToken) is { Length: > 0 } token + => OpenIddictHelpers.CreateAbsoluteUri( + left : new Uri("https://api.hubapi.com/oauth/v1/access-tokens", UriKind.Absolute), + right: new Uri(token, UriKind.Relative)), + // SuperOffice doesn't expose a static OpenID Connect userinfo endpoint but offers an API whose // absolute URI needs to be computed based on a special claim returned in the identity token. Providers.SuperOffice when diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 3e4b2601..831335d6 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -308,6 +308,31 @@ Description="The value used as the 'access_type' parameter (can be set to 'offline' to retrieve a refresh token)" /> + + + + + + + + + + + + + + +