This article describes how to add authentication for a Vimeo account to an Azure AD B2C custom policy.
Architecture
The following diagram illustrates the authentication flow for a Vimeo account to an Azure AD B2C custom policy.
For information about Vimeo and OAuth 2.0, see https://developer.vimeo.com/api/authentication.
Prerequisites
- If you don’t already have one, then you must create an Azure AD B2C tenant that is linked to your Azure subscription.
- Prepare your Azure AD B2C tenant by creating the token signing and encryption keys and creating the Identity Experience Framework applications.
- Download one of the starter packs for Azure AD B2C from Microsoft’s GitHub repository.
Configure a Vimeo application
- Log in to https://developer.vimeo.com/apps.
- On the My Apps page, select Create an app.
- On the Create a new app page, enter the following fields and then select Create App:
- App name
- App description
- Will people besides you be able to access your app?: Yes
- On the app page, copy the Client identifier field.
- On the app page, select Edit settings.
- On the Edit page, enter the following fields, copy the Client secret field, and then select Update:
- App URL
- Callback URL: Enter either
https://your-tenant-name.b2clogin.com/your-tenant-name.onmicrosoft.com/oauth2/authresp
if you use the built-in domain orhttps://your-domain-name/your-tenant-name.onmicrosoft.com/oauth2/authresp
if you use a custom domain for the Callback URL field. Replaceyour-tenant-name
with your tenant name andyour-domain-name
with your custom domain.
Add the client secret for the Vimeo application as a policy key
- Sign in to the Azure AD B2C portal.
- Select Identity Experience Framework.
- Select Policy keys.
- Select Add.
- In the Create a key section, enter the following fields and then select Create:
- Options:
Manual
- Name:
VimeoClientSecret
- Secret: Paste the Client secret field that was copied in the previous section.
- Options:
Configure Vimeo as an identity provider
- Open the TrustFrameworkExtensions.xml file.
- Find the ClaimsProviders element. If it doesn’t exist, then add it to the TrustFrameworkPolicy element.
- Add the following ClaimsProvider element to the ClaimsProviders element. Replace
your-vimeo-client-id
with the Client identifier field that was copied in the Configure a Vimeo application section.
<ClaimsProvider>
<Domain>vimeo.com</Domain>
<DisplayName>Vimeo</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="Vimeo-OAuth2">
<DisplayName>Vimeo</DisplayName>
<Protocol Name="OAuth2" />
<Metadata>
<Item Key="client_id">your-vimeo-client-id</Item>
<Item Key="authorization_endpoint">https://api.vimeo.com/oauth/authorize</Item>
<Item Key="AccessTokenEndpoint">https://api.vimeo.com/oauth/access_token</Item>
<Item Key="ClaimsEndpoint">https://api.vimeo.com/me</Item>
<Item Key="scope">public</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="token_endpoint_auth_method">client_secret_basic</Item>
<Item Key="BearerTokenTransmissionMethod">AuthorizationHeader</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_VimeoClientSecret" />
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" AlwaysUseDefaultValue="true" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="vimeo.com" AlwaysUseDefaultValue="true" />
<OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="resource_key" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="primary_email" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName" />
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName" />
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId" />
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-SocialLogin" />
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
Add a user journey
- Open the TrustFrameworkBase.xml file.
- Copy the UserJourney element that includes
Id="SignUpOrSignIn"
. - Open the TrustFrameworkExtensions.xml file and find the UserJourneys element. If it doesn’t exist, then add it to the TrustFrameworkPolicy element.
- Paste the UserJourney element that was copied in step 2 to the UserJourneys element and replace the Id attribute for this UserJourney element from
"SignUpOrSignIn"
to"VimeoSignUpOrSignIn"
.
Add the identity provider to the user journey
- Add the claims provider that was configured in the Configure Vimeo as an identity provider section to the user journey that was added in the previous section.
<OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuporsignin">
<ClaimsProviderSelections>
...
<ClaimsProviderSelection TargetClaimsExchangeId="VimeoExchange" />
</ClaimsProviderSelections>
...
</OrchestrationStep>
<OrchestrationStep Order="2" Type="ClaimsExchange">
...
<ClaimsExchanges>
<ClaimsExchange Id="VimeoExchange" TechnicalProfileReferenceId="Vimeo-OAuth2" />
</ClaimsExchanges>
...
</OrchestrationStep>
Configure the relying party policy
- Open the SignUpOrSignIn.xml file.
- Replace the ReferenceId attribute for the DefaultUserJourney element from
"SignUpOrSignIn"
to"
.
SignUpOrSignIn"Vimeo
<RelyingParty>
<DefaultUserJourney ReferenceId="VimeoSignUpSignIn" />
...
</RelyingParty>
Upload and test the custom policy
- Upload all policy files in the following order to your Azure AD B2C tenant:
- TrustFrameworkBase.xml
- TrustFrameworkLocalization.xml
- TrustFrameworkExtensions.xml
- SignUpOrSignIn.xml
- Test the B2C_1A_signup_signin policy from your Azure AD B2C tenant.