Browse Source

Add Notion to the list of supported providers

pull/1815/head
Kévin Chalet 3 years ago
parent
commit
ef6b61f5e0
  1. 9
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs
  2. 19
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

9
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs

@ -64,9 +64,16 @@ public static partial class OpenIddictClientWebIntegrationHandlers
var request = context.Transaction.GetHttpRequestMessage() ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0173));
// Notion requires sending an explicit API version (which is statically set
// to the last version known to be supported by the OpenIddict integration).
if (context.Registration.ProviderType is ProviderTypes.Notion)
{
request.Headers.Add("Notion-Version", "2022-06-28");
}
// Trakt requires sending both an API key (which is always the client identifier) and an API version
// (which is statically set to the last version known to be supported by the OpenIddict integration).
if (context.Registration.ProviderType is ProviderTypes.Trakt)
else if (context.Registration.ProviderType is ProviderTypes.Trakt)
{
request.Headers.Add("trakt-api-key", context.Registration.ClientId);
request.Headers.Add("trakt-api-version", "2");

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

@ -588,6 +588,25 @@
</Environment>
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▀██ ██ ▄▄▄ █▄▄ ▄▄█▄ ▄██ ▄▄▄ ██ ▀██ ██
██ █ █ ██ ███ ███ ████ ███ ███ ██ █ █ ██
██ ██▄ ██ ▀▀▀ ███ ███▀ ▀██ ▀▀▀ ██ ██▄ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<Provider Name="Notion" Id="8ed2d19d-bd97-4121-a3b1-61b6732c9cdd"
Documentation="https://developers.notion.com/docs/authorization">
<Environment Issuer="https://www.notion.com/">
<Configuration AuthorizationEndpoint="https://api.notion.com/v1/oauth/authorize"
TokenEndpoint="https://api.notion.com/v1/oauth/token"
UserinfoEndpoint="https://api.notion.com/v1/users/me">
<TokenEndpointAuthMethod Value="client_secret_basic" />
</Configuration>
</Environment>
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▄ █ ▄▄▀█▄▄ ▄▄██ ▄▄▀██ ▄▄▄██ ▄▄▄ ██ ▀██ ██

Loading…
Cancel
Save