Optimizely Forms Issue with Claims

This is a quick fix for an Optimizely Form issue when your implementation integrates Azure AD with OpenID Connect to sign-in/sign-out users on your application.

If you try to browse your page that contains an Optimizely Form and there is an active user session, you could probably get the following error:

A claim of type ‘http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier’ or ‘http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider’ was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by setting the static property AntiForgeryConfig.UniqueClaimTypeIdentifier.

This issue shouldn’t appear when you are an anonymous user (insognito mode).

There is a quick fix you could apply on the Global.asax.cs to repair this issue. Just add the following line into the Application_Start() method.

protected void Application_Start()

   AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimsIdentity.DefaultNameClaimType;

This will set the claim type from the identity that is used to uniquely identify the user.

Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: