This topic is locked
[SOLVED]

Phprunner with Azure AD

3/26/2024 8:03:12 AM
PHPRunner General questions
G
George K author

Hello all,

I am trying to integrate my app with the Azure AD but having some issues.
I have followed all the steps as per the documentation here https://xlinesoft.com/phprunner/docs/azuread_authentication.htm

As you can see on the screenshot, I have added two redirect URIs on Azure; one for localhost and one for the actual domain where the app is hosted (also on Azure).

img alt

When testing it on localhost, it works great. Azure AD user is authenticated and added on the users table. All work great there.

When testing it on the live host, I get an error AADSTS50011: The redirect URI 'http://xxxxxx.azurewebsites.net/openidcallback.php' specified in the request does not match the redirect URIs configured for the application

If I understand correctly , the redirect uri is automatically created by phprunner and should match what I have on the Azure app registration. However, I am noticing that the uri is an http while the redirect uri on Azure is https .I suspect that this is the problem.

img alt

Any help would be much appreciated.

Best
George K

admin 3/26/2024

This happens because somehow the web server doesn't report to PHP that it uses https protocol.
There is a workaround for this. Add this line to the 'After application initialized' event in PHPRunner:

$_SERVER['HTTPS'] = 'on';

Then build and publish your project once again.

G
George K author 3/26/2024

You are a star!

that worked great!

Best
George