microsoft / o365-moodle

Office 365 and Azure Active Directory plugins for Moodle
GNU General Public License v3.0
182 stars 136 forks source link

Clicking the OIDC login button redirects to the moodle homepage #251

Closed upats closed 6 years ago

upats commented 6 years ago

If I enable the OIDC Auth plugin, then click the login button on the login page, I simply get redirected back to the Moodle home page. No auth redirect flow happens.

I am using the Authorization Code Flow method. The redirect URI is set properly in Azure AD and all of the endpoints are set up correctly.

The one thing I have not set up is the "local_o365 | adminconsent" option since I don't think that's strictly necessary for just OIDC authentication. The Azure AD Application has all of the other necessary permissions set properly.

If you don't have the local_o365 | adminconsent set, will the OIDC login button not work correctly? I'm not sure why this won't work :(

I'm on Moodle 3.4.3+ and the latest Moodle 3.4 stable branches of the o365 plugins.

jamesmcq commented 6 years ago

Hi @upats - are you logged in when you return to the Moodle homepage? If not, can you verify the entire request chain you're seeing? Sometimes redirects happen in the background without being visible. If you're using Chrome, you can verify using the "Network" tab of your browser's developer tools. Be sure to check "Preserve Log".

KibosJ commented 6 years ago

I'm getting this too, but only when someone tries to log in after clicking on a link in Moodle.

Deleting all and any cookies relating to Moodle allows the user to then sign in.

KibosJ commented 6 years ago

Until this issue can be resolved I have added this code to the /login/index.php file and that has sorted it.

// Delete MoodleSession Cookie if (isset($_COOKIE['MoodleSession'])) { unset($_COOKIE['MoodleSession']); setcookie('MoodleSession', '', time() - 3600, '/'); // empty value and old timestamp }

jamesmcq commented 6 years ago

Hi all - I'm closing this as it doesn't appear to be something caused by the plugins themselves - possibly is a Moodle core issue. If you have any more information I'd be glad to continue investigation.