title: Add app extension attribute in user flow JWT Azure AD B2C
body: <p>I am working in Azure AD B2C to add custom extensions per application. Theses extensions must be returned in the jwt when the login is requested by the application.</p>
  <p>So I create the extension on the app using the graph api</p>
  <pre><code>POST https://graph.microsoft.com/v1.0/applications/{{appid}}/extensionProperties
  {
      &quot;name&quot;: &quot;name&quot;,
      &quot;dataType&quot;: &quot;String&quot;,
      &quot;targetObjects&quot;: [
          &quot;User&quot;
      ]
  }
  </code></pre>
  <p>Then I associate a value for a specific user</p>
  <pre><code>PATCH https://graph.microsoft.com/v1.0/users/{{userid}}
  {
      &quot;extension_{{appid(without dashes}}_name&quot;: &quot;1234&quot;
  }
  </code></pre>
  <p>Now I go on the app manifest to add the optional claim.</p>
  <pre><code>&quot;optionalClaims&quot;: {
          &quot;idToken&quot;: [
              {
                  &quot;name&quot;: &quot;extension_{{appid(without dashes}}_name&quot;,
                  &quot;source&quot;: &quot;user&quot;,
                  &quot;essential&quot;: true,
                  &quot;additionalProperties&quot;: []
              }
          ],
          &quot;accessToken&quot;: [
              {
                  &quot;name&quot;: &quot;extension_{{appid(without dashes}}_name&quot;,
                  &quot;source&quot;: &quot;user&quot;,
                  &quot;essential&quot;: true,
                  &quot;additionalProperties&quot;: []
              }
          ],
          &quot;saml2Token&quot;: []
      },
  </code></pre>
  <p>Save but the claim never appear on the jwt token.</p>
  <p>I also tried using the answer of <a href="https://stackoverflow.com/questions/56106717/how-to-pass-custom-extension-attributes-from-azure-active-directory-in-jwt-token">this</a> post but didn't work either.</p>