title: Endpoint belongs to different authority
body: <p>trying to use Azure AD as OpenID provider with <a href="https://www.nuget.org/packages/IdentityModel/3.10.10" rel="noreferrer">IdentityModel</a> package</p>
  
  <p>However the problem is that it produces wrong endpoint configuration</p>
  
  <pre><code>var client = new HttpClient();
  
  const string identityUrl = "https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/v2.0";
  const string restUrl = "https://localhost:44321";
  
  var disco = await client.GetDiscoveryDocumentAsync(identityUrl);
  if (disco.IsError)
  {
      Console.WriteLine(disco.Error); 
      return;
  }
  </code></pre>
  
  <p>returns error </p>
  
  <blockquote>
    <p>Endpoint belongs to different authority:
    <a href="https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/oauth2/v2.0/authorize" rel="noreferrer">https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/oauth2/v2.0/authorize</a></p>
  </blockquote>
  
  <p><a href="https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/v2.0/.well-known/openid-configuration" rel="noreferrer">openid-configuration</a> output is </p>
  
  <pre><code>{"authorization_endpoint":"https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/oauth2/v2.0/authorize",
  "token_endpoint":"https://login.microsoftonline.com/00edae13-e792-4bc1-92ef-92a02ec1d939/oauth2/v2.0/token" ... }
  </code></pre>
  
  <p><code>oauth2</code> is added between the tenatID and version. I suppose this is why openid metadata validation fails.</p>
  
  <p>Is it possible to configure AzureAD to return correct metadata for the openid-configuration ?</p>
  
  <p>Regards</p>