Using PHP and LDAP to connect to Microsoft Office 365

21,099

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:

  1. How to implement single sign-on with Windows Azure Active Directory - PHP Application
  2. 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).
Share:
21,099
Josh Ripley
Author by

Josh Ripley

Updated on July 09, 2022

Comments

  • Josh Ripley
    Josh Ripley almost 2 years

    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.

  • Josh Ripley
    Josh Ripley almost 12 years
    Thank you for the response... After looking at your example, my question would be: What should the LDAPSERVER and LDAPBINDDN variables be defined as to connect to the Office 365 server?
  • user1415567
    user1415567 almost 12 years
    the LDAPSERVER is the location of your server or its address and for the LDAPBINDDN read this ldapman.org/articles/intro_to_ldap.html as you need to know where your user is in the active directory first
  • John
    John over 9 years
    @user1415567 I'm also wondering what "my server" is supposed to be. I don't have a server, I'm with Office365. There are per-account servers for mail at xyz.mail.protection.outlook.com and for the web at xyz.sharepoint.com. But it's not going to be one of those, is it?
  • jaytho
    jaytho over 7 years
    above Link is 404; link is thorough and expands on the original