How to integrate with Azure AD

I am trying to integrate Auth0 with Azure AD, as shown here - https://auth0.com/docs/tutorials/building-multi-tenant-saas-applications-with-azure-active-directory

I am able to create my Azure AD connection in the Auth0 portal and test it, and that all works. I am trying to get this working with the sample application that is referenced in the documentation - https://github.com/auth0-samples/auth0-azuread-multi-tenant-apps-sample. I am redirected to the Azure AD login page, enter my credentials and I get an access denied error - “http://localhost:55000/account/callback?error=access_denied

The sample application seems to be out of date, as the repo has not been updated in 2+ years, and the code in the article does not match what is in the repo. I have tried updating the sample app to match the article but still no luck.

I see a successful login in the Logs for the Auth0 portal, with an entry for “Authorization Code for Access Token”. So my credentials are correct and I appear to be authenticated but the application still throws an error.

This is the error I get - Could not get the external identity. Please check your Auth0 configuration settings and ensure that you configured UseCookieAuthentication and UseExternalSignInCookie in the OWIN Startup class. Also make sure you are not calling setting the callbackOnLocationHash option on the JavaScript login widget.

I have checked the configuration settings and everything appears to be correct.

So I have two questions:

  1. How can I resolve the “access denied” error and get the sample app working?
  2. Is there an updated sample that shows the correct way to integrate Azure AD and Auth0?