-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST /auth/oidc returns a 404 and logs error ID 3 in the Moodle logs for some users #1834
Comments
Hi @chrisfosterelli, Assuming you are using the "Authorization code flow" in auth_oidc settings, the error you saw can be thrown at two occasions:
Please check which situation your user is in. Regards, |
Hey @weilai-irl Thanks a lot for the response.
Correct, this is the authorization code flow.
This setting is not enabled. Additionally, the user does have an account (the Moodle log shows the account in the 'affected user' column when it shows the error ID 3)
If I search the table for the user's OIDC username, one row exists and the userid points to the correct Moodle account. |
We have enabled some additional debugging and captured some relevant stack traces: During the request, it first triggers this warning:
Then eventually throws with:
So it seems the final exception ultimately comes from here, suggesting that the call to moodle's The first error that we see, about there being more than one record, seems to come from here, which is a query to the same table that you just mentioned. However, when I query the table, there is only one record. This may be because this section of code tries to delete the token, but does it based on the token ID rather than the username, so it'd only be clearing the first token that was returned up in the call to Does that help at all? Should we delete the existing token in the table? Is my understanding correct that there is a new token being inserted on each request (I guess from here, meaning the oidcuniqid is not matching the one in the table) that is invalid, and then removed? |
@weilai-irl To update on this, we tried removing the token from the So not too sure what the root cause was unfortunately. If you wish us to close this that's OK with me as it's technically resolved for us, but I'll leave it open for now in case you have thoughts or think this is a bug that needs further addressing. |
As an update, we have seen this happen with two additional students, both who have not logged in in some time. |
@chrisfosterelli did you get any further in solving the issue which you are seeing. We are possibly seeing the same thing (I’ll do some log digging tomorrow). What we see only effects a small number of users and only starts to re-occur after a new version of the o365 plugins has been installed. We have just installed the oct release and students are reporting this to us, but in small numbers. To solve we currently take this users id and delete their token from the mdl_auth_oidc_token table & get the student to login again. We are now thinking maybe because this seems to only occur after a new version is deployed, whether we should be deleting the entire mdl_auth_oidc_token table after deployment. As you say it always creates a new token on login. We have done this before without any issues as we had to many people experiencing it. Something does not match on some peoples accounts… it could be certain devices / browsers which are causing it. Hopefully in the next few days I’ll have some more information to report and help @weilai-irl solve for good. |
@mmulrthelp Not much further unfortunately. We got as far as determining that all the accounts exhibiting the issue were really old but had signed in at least once. We think it was associated with an upgrade as well. The impact was small enough that we opted to manually delete any students that reached out with the error rather than continue investigating. We did an upgrade a few days later to 3.11.1 which mentioned it rewrote a lot of the logic so we were hoping that'd help. I haven't heard anything on this from the staff since then. |
Hi there,
For some users, when they attempt to login, the login is recorded as successful on the O365 side, but fails on the Moodle side.
The request logs show the normal flow we would expect: they land on the home page, are redirected (we use the forced redirect), and then POST back to
/auth/oidc
.However, instead of a successful login event from the OIDC plugin, we see a Moodle system event: "Login failed for user 'XXX'. Most likely the password did not match (error ID '3')"
The status code of the request is returned as 404, instead of the usual 303, which makes it apparent in the logs.
I have tried digging into the root cause but, without ability to directly reproduce, am finding it difficult to sort out. Do you have any advice for how this can happen, or where to look further?
The text was updated successfully, but these errors were encountered: