Browse Source

Add Typeform to the list of supported providers

pull/2130/head
Kévin Chalet 2 years ago
parent
commit
914a7e6712
  1. 6
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  2. 26
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

6
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs

@ -1276,13 +1276,17 @@ public static partial class OpenIddictClientWebIntegrationHandlers
// Trovo returns the username as a custom "userName" node:
ProviderTypes.Trovo => (string?) context.UserinfoResponse?["userName"],
// Typeform returns the username as a custom "alias" node:
ProviderTypes.Typeform => (string?) context.UserinfoResponse?["alias"],
_ => context.MergedPrincipal.GetClaim(ClaimTypes.Name)
});
context.MergedPrincipal.SetClaim(ClaimTypes.NameIdentifier, issuer: issuer, value: context.Registration.ProviderType switch
{
// These providers return the user identifier as a custom "user_id" node:
ProviderTypes.Amazon or ProviderTypes.HubSpot or ProviderTypes.StackExchange
ProviderTypes.Amazon or ProviderTypes.HubSpot or
ProviderTypes.StackExchange or ProviderTypes.Typeform
=> (string?) context.UserinfoResponse?["user_id"],
// ArcGIS and Trakt don't return a user identifier and require using the username as the identifier:

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

@ -1964,6 +1964,32 @@
</Setting>
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▄▄ ▄▄██ ███ ██ ▄▄ ██ ▄▄▄██ ▄▄▄██ ▄▄▄ ██ ▄▄▀██ ▄▀▄ ██
███ ████▄▀▀▀▄██ ▀▀ ██ ▄▄▄██ ▄▄███ ███ ██ ▀▀▄██ █ █ ██
███ ██████ ████ █████ ▀▀▀██ █████ ▀▀▀ ██ ██ ██ ███ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<Provider Name="Typeform" Id="7100d684-c02b-4da2-86bc-d6c42b117fee"
Documentation="https://www.typeform.com/developers/get-started/applications/">
<Environment Issuer="https://www.typeform.com/">
<Configuration AuthorizationEndpoint="https://api.typeform.com/oauth/authorize"
TokenEndpoint="https://api.typeform.com/oauth/token"
UserinfoEndpoint="https://api.typeform.com/me">
<GrantType Value="authorization_code" />
<GrantType Value="refresh_token" />
</Configuration>
<!--
Note: Typeform requires sending the "accounts:read" scope to be able to use the userinfo endpoint.
-->
<Scope Name="accounts:read" Default="true" Required="true" />
</Environment>
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ███ █ ▄▄▄██ ▄▄▀█▄ ▄██ ▄▀▄ █▄ ▄██

Loading…
Cancel
Save