access to my Office 365 third-party app for external user : “a User account is not registered for the account” RRS feed

  • Question

  • I am writing an application to access data (email, contacts, calendar) of user in office 365. So i need to enable the access to my for external user.

    I've followed the instructions of microsoft office here ( and defined in the Azure portal my app as a multi-tenant.

    Then I have to use Oauth2 to access the data ( )

    When I follow the steps in the link above, I get an error in the response of the first get request (the authorisation request):

    request sent:




    And I can retrieve the auth code and the access token perfectly for the user of my account but not for external users.

    Does anybody have an idea on how I can fix this problem?

    Thank you!

    • Edited by nicolas155 Friday, August 15, 2014 2:09 PM
    Thursday, August 14, 2014 7:55 PM



    This was answered on StackOverflow by Dushyant Gill.

    You are sending the OAuth request to a tenant specific endpoint of Azure AD. Note the {key_provided} part of your Url - that part represents the tenantid or a registered domain name of an Azure AD tenant. Azure AD throws this error is the user signing in is not a user in that tenant.

    Multi-tenant applications like yours have two options:

    1. Perform home realm discovery yourself and send the SSO request to the correct tenant-specific endpoint of Azure AD: when a new Azure AD organization signs-up for your application, record its tenant ID, and registered domain names. On your login page, ask the user for their email and try to discover what Org they belong to using the suffix the email.
    2. Use the common endpoint of Azure AD. Instead of the {key_provided} part of the URL, use 'common'. In this case Azure AD will determine the user's tenant and sign-in the user. The token that your application will receive will still be from the user's tenant (iss claim).

    2 is more convenient for apps. However #1 has an advantage when the user's Organization has customized their sign-in page with the company logo etc - in the case of #1 the user will directly be taken to the customized and familiar sign-in page.

    I recommend a combination of the two: try determining the user's organization and sending them to the tenant specific SSO endpoint. If you're not able to - send them to the common endpoint.

    Friday, August 22, 2014 2:10 PM