Token Refresh Blocked By Multi-Factor Auth (MFA) #1134
Labels
Issue type - help wanted
General questions on how to use the plugins, e.g. configurations etc.
Plugin - local_o365
Triaging status - triaged
A ticket has been created accordingly in the maintainers' ticket system.
Hello, last week I upgraded my site and plugins from Moodle 3.4.8 -> 3.6.5 and office 365 plugins from the latest stable 3.4. to 3.6 branch.
After the upgrade, some users report that their Moodle/Outlook Calendar sync was broken. For most users refreshing the token from the Microsoft Block works fine to restore the connection. For some users, they still get an error message "Exception: No token available for user #moodleidhere" when trying to view their calendar sync settings, even after refreshing. Looking in the DB local_office365_token table confirms there are no tokens for these users.
From looking at logs I saw this had to do with Azure MFA, which our school implemented over the summer. As a note, we have MFA rules in place for the Moodle Azure app so that users only see an MFA confirmation if they access Moodle from off-campus.
So in this case, it seems that some users had not done MFA for Moodle for a while if they were only accessing it from on-campus. When they tried to refresh the token, it required MFA, but the user was not given an MFA request because they were on our campus. If the user still had a non-expired MFA token for Moodle, it works, but if they don't it fails silently.
We are able give users the workaround of forcing an MFA request by having them try from off-campus (or via LTE instead of WiFi) but hope to find a solution that would get around this problem coming up for users at all without relaxing our MFA rules.
I realize the Office 365 Moodle plugin folks might not be the best team to solve this, please let me know if there is a better Microsoft resource to ask.
This was the output logged as an API failure:
local_o365\oauth2\token::get_for_new_resource: Problem encountered getting a new token. Data: Array ( [tokenresult] => Array ( [error] => interaction_required [error_description] => AADSTS50076: Due to a configuration change made by your administrator,
or because you moved to a new location, you must use multi-factor authentication to access '00000003-0000-0000-c000-000000000000'. Trace ID: 46ac71cb-05e0-4f22-baf5-23fabd719400 Correlation ID: a886caee-0a8d-4e03-919c-b6e6e3c455e7 Timestamp: 2019-08-19 16:20:53Z
[error_codes] => Array ( [0] => 50076 ) [timestamp] => 2019-08-19 16:20:53Z [trace_id] => 46ac71cb-05e0-4f22-baf5-23fabd719400 [correlation_id] => a886caee-0a8d-4e03-919c-b6e6e3c455e7 [error_uri] => https://login.microsoftonline.com/error?code=50076 [suberror]
=> basic_action [claims] => {"access_token":{"capolids":{"essential":true,"values":["97dfdcd9-18a8-4da5-904e-569f35938d9b"]}}} ) [resource] => https://graph.microsoft.com )
The text was updated successfully, but these errors were encountered: