Azure AD Sign On (OAuth 2) doesn't always work

Azure AD Sign On (OAuth 2) doesn't always work

by J C -
Number of replies: 4

I have also posted this on the Moodle Tracker site. Please vote for the issue if you are experiencing the same problem. Issue number is: MDL-65945.


Hello,

We use Microsoft Azure AD sign on for our Moodle Cloud site (version 3.6.4). 

However, for many of our users (including me and I have site administrator permissions), it often does not work.

Occasionally it will work for me, but I often get a message that says "Your session has most likely timed out. Please log in again." When I click on Continue it takes me back to the log in page, and then the cycle repeats over and over again. Occasionally I can see the left hand menu as well as the error and then I can enter the Moodle site through the menu, but not always. It's often this cycle: Click on the Azure AD sign on, select my account, get error, click continue, repeat.

When I click on "More information about this error" it takes me to this site: https://docs.moodle.org/36/en/error/moodle/invalidsesskey. Should we be checking out these options or is this likely a different kind of issue?

One more thing I've noticed is that for some people, the authentication method shows as "OAuth2" in their profile. However, we always select "Manual accounts" when we create users, so I'm unsure how some say "OAuth2" or if that is in any way connected to the issue we are having.

Thank you and please let me know if you require any further information. See screenshots of our OAuth 2 services setting and the error I receive.

OAuth 2 settingsError message
Average of ratings: -
In reply to J C

Re: Azure AD Sign On (OAuth 2) doesn't always work

by Steve Massicotte -
Hi JC,

are you using Azure AD B2C ? I'm trying to make it work but I fall into a redirect loop.

I put some trace and I found that we are not able to upgrade the token to an access_token.

I manage to make it work with https://moodle.org/plugins/auth_oidc but we prefere to use the core Oauth2 plugin (because it's core).

Thanks

Steve
In reply to Steve Massicotte

Re: Azure AD Sign On (OAuth 2) doesn't always work

by Mathieu Petit-Clair -
Picture of Core developers Picture of Moodle HQ Picture of MoodleCloud team Picture of Plugin developers Picture of Testers
Hey, bonjour Steve, ça fait un bail..!

Could you add as much detail as possible to the tracker issue (MDL-65945) about the failed upgrade to an access_token?

Merci!

Mathieu - à temps plein sur MoodleCloud sourire
In reply to Mathieu Petit-Clair

Re: Azure AD Sign On (OAuth 2) doesn't always work

by Steve Massicotte -
Salut Mathieu !! En effet ça fait un bout de temps.

I will add as much detail as possible. I also create another tracker https://tracker.moodle.org/browse/MDL-66997. Maybe you want to close it an put everything into the MDL-65945.