Search code examples
office365office365api

Office 365 API User Consent for external Office 365 Business Account


I have registered an App ABC on Azure Portal. App ABC has a Client ID: XYZ999 and Client Secret: MNO123

There are two users O365 Business accounts.

1) [email protected] (Associated with the Azure Portal which I used to register App ABC)

2) [email protected] (This is an external O365 Account of a third person. This is not associated with my Azure Portal directory or user)

I have a button on my page. Clicking this button should allow my application to authenticate/ask user consent and provide me the Auth Code using which I can generate the Access Token.

Clicking this button redirects the user to https://login.windows.net/common/oauth2/authorize?response_type=code&resource=https%3A%2F%2Fmanage.office.com&client_id=XYZ999&redirect_uri=SomeUrl

Redirection is correct, it shows me the correct login page.

If i login by providing credential for UserA, the login is successful and I am able to see a page which allows the user to grant access to App ABC. Post this the user is redirect to "SomeUrl" with a correct "code" in the URL parameter.

The problem -> But when I try to login by providing credentials for UserB, right after clicking on the Login button, i receive the error, Client ID is not found in Directory yyy.onmicrosoft.com.

I have tried to switch the Multi Tenant from "No" to "Yes" for my App ABC on the Azure Portal but it did not help.

What am I missing?


Solution

  • It seems that Azure AD took a bit of time for Multi Tenant:"Yes" option on Azure AD to come into effect.