Search code examples
azure-active-directorysamlonelogin

Redirect not working for SAML login, php-saml with Azure Active Directory


I've integrated SAML using php-saml to connect using WSO2 Server Identity Server for local and it's working perfectly.

However, the redirection is not working in case of Azure Active Directory. It just redirects to office.com and stays there.

Here's the SAML Response for Azure:

ResponseData
status      302
statusText  
httpVersion http/2.0
redirectURL https://login.microsoftonline.com/
headersSize -1
bodySize    -1
_transferSize   690
_error  null

SAML Response for WSO2 :

Response Data
status  302
statusText  Found
httpVersion HTTP/1.1
redirectURL http://app.test
headersSize 884
bodySize    0
_transferSize   884
_error  null


Solution

    1. Please make sure Redirect URI present in the code ex: https://your.domain.name/oauth.php must be given in redirect url app registrations in azure portal and then please check if configuration for SAML with entity url, signle sign on url etc.. are correct.
    2. Make sure to update IDP and sp in metadata to upload during saml configuration.
    3. Azure ad only supports Https protocol, make sure your redirect url starts with Https except for localhost Go through the below document step by step for further details

    Reference: Azure AD Single Sign-On with SimpleSAMLphp – My IT Daily (wordpress.com)