AADSTS700016 Adal problem with wrong tenant directory

I am having a problem with my react application and authentication with adal-ms-react (link). I followed up installation but run into a problem with code AADSTS700016. This suggests that my tenant directory is not correct, which definitely is not (I can see it where I registered my app on Azure portal.

Problem is I have no idea where to set my correct directory in my react app. There is a place for client ID and redirectURL but no tenant or tenantId.

loginMSSPecs

Anybody having knowledge where to set it up so it refers to correct directory? This resource looks like is old 2 years, maybe that is the problem?

Upvotes: 3

Views: 6672

Answers (2)

Tony Ju
Tony Ju

Reputation: 15629

You don't need to configure the tenant information since this react app is a multi-tenant application. You can find its oauthUrl in index.jsx file. It's using common, not specific tenant.

this.oauthUrl = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";

You can find more details of multi-tenant here.

Besides, the auth url is using v2.0 endpoint. So you need to register your app in Microsoft App Dev Center. If you want to register your app in Azure portal, you need to register it under App registrations(Preview) which applies to v2.0 endpoint.

enter image description here

Upvotes: 2

Gaurav Mantri
Gaurav Mantri

Reputation: 136369

The reason you're getting this error is because the application is registered in wrong place. You're making use of Azure AD v2.0 endpoint and the application using this needs to be registered at https://apps.dev.microsoft.com/ and not Azure Portal. Azure Portal should be used to register applications targeting Azure AD v1.0 endpoints.

To learn more about registering an app with the Azure AD v2.0 endpoint, please see this: https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-register-an-app.

Upvotes: 1

Related Questions