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.