azure-active-directorywindows-live-idmod-auth-openidc

Trying to use Converged Microsoft Account and Azure AD with mod_auth_openidc


After reading the following article:

http://blogs.technet.com/b/ad/archive/2015/08/12/azure-ad-microsoft-account-preview-sign-in-personal-and-work-accounts-using-a-single-stack.aspx

I tried to implement an OpenID Connect/Oauth code flow per the documentation at:

https://azure.microsoft.com/en-us/documentation/articles/active-directory-appmodel-v2-overview/

I'm using mod_auth_openidc as my Relying Party (that I have working with both Google and my own OpenID Provider.

I've registered my app at https://apps.dev.microsoft.com, and gone through all the steps. I get the login screen at microsoft, then the permissions screen and when it redirects back to my site and hits mod_auth_openidc, I get an error that says:

Error:

The OpenID Connect Provider returned an error: Error in handling response type.

In my Apache Error logs I get: oidc_proto_validate_code_response: requested flow is "code" but no "access_token" parameter found in the code response, referer: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&scope=openid&client_id=xxx&state=yyy&redirect_uri=https%3A%2F%2Fdst-dev.mydomain.com%2Foauth2callback&nonce=zzz

and

oidc_proto_resolve_code_and_validate_response: code response validation failed,

What I'm trying to figure out is where the problem lies. Is there an issue with what Microsoft is sending mod_auth_openidc, or is there a bug or configuration issue on the mod_auth_openidc side?


Solution

  • The example at MS webpages uses a different response mode and response type in the authentication request:

    &response_mode=form_post&response_type=code+id_token
    

    both are supported by mod_auth_openidc so you could apply something similar by including:

    OIDCResponseType id_token
    OIDCResponseMode form_post
    

    in the Apache configuration or using the associated primitives in the .conf file for Microsoft when using multiple providers.