Using PHP and LDAP to connect to Microsoft Office 365

authentication, ldap, office365, php

Solution

This is possible. Microsoft has recently released a Developer Preview for their Windows Azure cloud platform which functions like many other cloud computing services (Amazon, Pagoda Box, Heroku). Along with this new product is the ability for developed apps to leverage Single Sign On using your Office365 account credentials.

Here are a few articles that go over the PHP process:

- How to implement single sign-on with Windows Azure Active Directory - PHP Application

- Get Started with Windows Azure Active Directory

Notes:

- Example one has its source in a git repo. This repo does not include a referenced .csproj file, so you will have to build the project with the included 3 source files. If I can do it, you can do it :).

- It should also be noted that after Office365 authentication is complete and reroutes back to your app, it expects the return URL to be HTTPS, if it is not you will get an error (or at least I did).

Problem

The company that I work for has migrated their local exchange to a hosted Office 365 solution. We are in the process of building out several externally(to our local network) hosted websites and would like to use LDAP authentication to build upon our existing, hosted user base. Can anyone explain or point to some documentation of a way to use PHP and LDAP to connect to a remotely hosted AD (in this case Office 365) and authenticate users to it? Thank you for your time and effort.

Original source