Browse Source

Update the Reddit integration to support the duration parameter

pull/1600/head
Kévin Chalet 3 years ago
parent
commit
3cd35a04bd
  1. 3
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs
  2. 7
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  3. 6
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

3
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 =>
{

7
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;
}
}

6
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

@ -125,6 +125,9 @@
<Configuration AuthorizationEndpoint="https://www.reddit.com/api/v1/authorize"
TokenEndpoint="https://www.reddit.com/api/v1/access_token"
UserinfoEndpoint="https://oauth.reddit.com/api/v1/me">
<GrantType Value="authorization_code" />
<GrantType Value="refresh_token" />
<TokenEndpointAuthMethod Value="client_secret_basic" />
</Configuration>
@ -137,6 +140,9 @@
<Scope Name="identity" Default="true" Required="true" />
</Environment>
<Setting PropertyName="Duration" ParameterName="duration" Type="String" Required="false"
Description="The value used as the 'duration' parameter (can be set to 'permanent' to retrieve a refresh token)" />
</Provider>
<Provider Name="StackExchange" Documentation="https://api.stackexchange.com/docs/authentication">

Loading…
Cancel
Save