From 3cd35a04bd66cd045f1126d06b5a2cc5e1aea19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sun, 27 Nov 2022 08:30:29 +0100 Subject: [PATCH] Update the Reddit integration to support the duration parameter --- sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs | 3 ++- .../OpenIddictClientWebIntegrationHandlers.cs | 7 +++++++ .../OpenIddictClientWebIntegrationProviders.xml | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs index 5a1c3703..f3583a5c 100644 --- a/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs +++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs @@ -147,7 +147,8 @@ public class Startup { options.SetClientId("vDLNqhrkwrvqHgnoBWF3og") .SetClientSecret("Tpab28Dz0upyZLqn7AN3GFD1O-zaAw") - .SetRedirectUri("https://localhost:44381/callback/login/reddit"); + .SetRedirectUri("https://localhost:44381/callback/login/reddit") + .SetDuration("permanent"); }) .UseTwitter(options => { diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index fc5a9c90..c57ba988 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -545,6 +545,13 @@ public static partial class OpenIddictClientWebIntegrationHandlers context.Request["access_type"] = options.AccessType; } + else if (context.Registration.ProviderName is Providers.Reddit) + { + var options = context.Registration.GetRedditOptions(); + + context.Request["duration"] = options.Duration; + } + return default; } } diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 3a6e979c..8f42a7d9 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -125,6 +125,9 @@ + + + @@ -137,6 +140,9 @@ + +