wpo365 / wpo365-login

Wordpress + Office 365 login is a Wordpress Plugin that allows Micrsoft O365 users to seamlessly and securely log on to your corporate Wordpress intranet. The plugin will create a Wordpress user for each corporate user when logged on to Office 365 and thus avoiding the default Wordpress login screen: No username or password required.
https://www.wpo365.com/
Other
11 stars 7 forks source link

Stuck in a Loop - Multisite #38

Closed amycirca closed 5 years ago

amycirca commented 5 years ago

I installed this plugin for an employee site that is on a multisite hosted by Flywheel. I followed this video https://youtu.be/fM4TSbNS-R4 and the plugin appear that is set up correctly but when I tested it (I logged out, went to our site, was prompted by Microsoft to login, it is stuck in a loop and won't load. Neither of the sites in the multisite are live yet. Does that make a difference? Do you know what else could be causing an issue?

Do you ever schedule phone calls or screen shares so that I could show you what we are doing and where I might be doing something wrong?

Looking forward to hearing from you. Thanks!!

wpo365 commented 5 years ago

Hi @amycirca The reason when you end up in an endless loop is that the plugin cannot detect the authorization / ID token in the request sent by Microsoft when it redirects the user back to your site. The most likely reason for this is that your server is redirecting the request before it is processed and then the information Microsoft initially put in the request gets lost and as a result the request is considered "not authenticated" and the user is sent back to Microsoft to authenticate ... Well, you can see what happens next ... So basically you need to check your WordPress configuration. Very often the cause can be found in the .htaccess file that sends a user that navigates to https://www.yourwebsite.com to https://www.yourwebsite.com/ or maybe you redirect from http to https or from https://www.yourwebsite.com to https://yourwebsite.com ... I recommend you analyze using the Chrome browser the network traffic whilst you check the "preserve log" box. You should see some redirect immediately after your request is redirected from login.microsoftonline.com ... To solve it, you need to make sure that your website is available under a unique web address and that the reply address you entered in Azure AD is the address that when used does not result in redirect. So if you .htaccess is setup to always redirect a user from https://www.yourwebsite.com to https://www.yourwebsite.com/ then make sure that the reply address you entered for the registered application in Azure AD already has the trailing / so the request doesn't get redirected ... I hope this makes sense!

amycirca commented 5 years ago

OMG That worked!!!!! I just add a slash to the end of the url and it worked!! So simple yet something I never would've figured out in a million years. THANK YOU!!!!!!!!!

wpo365 commented 5 years ago

Seems solved so I close the issue.