Home > front end >  Can I implement Azure AD Authentication into an existing PHP application
Can I implement Azure AD Authentication into an existing PHP application

Time:09-23

I built and maintain a PHP web application with an existing set of users. Authentication is username password, within the application.

There is now a requirement to provide access to a large new set of users, with existing Azure AD accounts. The client wants these users to be able to login using their Azure identities. The existing users would continue to authenticate the way they currently do.

I assumed this would be similar to Facebook/Google etc. SSO , but I'm struggling to find any examples of this in the Microsoft resources, or any libraries out there that will enable this. Is what I describe a valid use case, and achievable with Azuer AD Authentication?

CodePudding user response:

Azure AD authentication with PHP is really straightforward using Microsoft Graph. I have enter image description here

  1. Use the Authorization Code to Request an Access Token: enter image description here

Please check this enter image description here

2)After creating app registration Copy the client ID and tenant ID, pasting them into _OAUTH_SERVER and _OAUTH_CLIENTID in config.inc. The _OAUTH_SERVER entry should be the login.microsoftonline.com URL but with TENANT_ID replaced with your directory (tenant) ID

enter image description here

3)add a new secret and select the appropriate time. Don’t forget you will need to update this before it expires, so make a note in your calendar. Once done, copy the secret value and paste this into _OAUTH_SECRET within config.inc

4)After that able to browse to your application and be prompted to log in.. On your first go, you’ll be asked to allow permissions for everyone on your tenant (assuming you have the appropriate admin rights).

enter image description here

  • Related