microsoft / o365-moodle

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

Unable to add course to Team after plugin upgrade from 3.8.0.3 to 3.8.0.4 #1466

Closed klovsb closed 3 years ago

klovsb commented 3 years ago

Environment: on-premise Moodle 3.8.4+. Windows Server 2012 R2. PHP 7.2x64. Local_365 version 3.8.0.4. auth_oidc version 3.8.0.3. Boost Office365 Teams version 3.8.0.3.

We used to be able to login to Office 365 from within Teams and select course to add to the channel as a tab. After upgrading the plugin to 3.8.0.4 and going through all Teams setting, we have been unable to add course to Team. Usually nothing happens after a user click on Login Office 365 in Teams. Sometimes, the screen will briefly display some courses but in a fraction of a second it'll jump back to the login prompt. Sometimes, it will briefly display that there is no course to add and jump back to the login prompt.

Record debug messages is enabled. There is no error found in PHP error log or Moodle's server log.

There is no option to uninstall and roll-back to 3.8.0.3.

weilai-irl commented 3 years ago

Hi @klovsb,

Upgrading the plugins from 3.8.0.3 release to 3.8.0.4 release requires configuration changes in Azure. Please see https://docs.moodle.org/310/en/Office365#3.8.0.4_and_3.9.1_release. This is linked from release note.

Please follow the instructions and try again.

FYI, Moodle plugins don't support "downgrade". The plugin can be uninstalled though, but it requires all plugins that have dependencies on it (local_office365, local_onenote, theme_boost_o365teams etc) to be uninstalled first; again this is standard Moodle plugin operations.

Regards, Lai

klovsb commented 3 years ago

I am pretty sure our Office 365 admin has gone through all tenant settings. Would existing tabs in Teams break during the uninstallation and re-installation of an older version? Does version 3.8.0.3 work for Moodle sites in same organization?

klovsb commented 3 years ago

When trying to add Moodle course either in Teams App or in Teams in a browser (Chrome version 86), I would click on Login to O365 and nothing happens. If I click on Login Manually, I can use OpenID Connect to automatically login and it will show me my courses briefly before kicking me back to the login prompt. If I click on Login Manually again, it will say that I am already login and ask me to confirm logout. If I confirm it'll log me out of Moodle and expectedly keep me signed in in Teams. 2020/11/16 corrected some typo

benzini00 commented 3 years ago

I'm seeing this exact same behaviour with the Moodle app in Teams after updating our plugins to 3.8.0.5, all required configuration changes have been made and double checked in Azure.

klovsb commented 3 years ago

in our PHP error log, we see a number of these entries PHP Notice: SKIPPED: handle_notification_sent - course record doesn't have an object ID

weilai-irl commented 3 years ago

Hi @klovsb,

First of all, I can confirm that the warning message in your latest post is separate from the main issue reported in this one. It is caused by an observer function that tries determine if it needs to trigger a notification in Moodle bot in Teams. The message itself is for debugging purposes only, and would not break things.

Back to the main issue reported, I see a few things that may be relevant.

  1. If you have multiple Moodle sites, and want to generate a Moodle Teams app from each of them, and upload it to Teams, you would need to manually modify the manifest file before 3.8.0.3. This is because all manifest files created from all Moodle sites would carry the same app ID and app name, thus uploading a second one would overwrite (update) the previous one, therefor you will only see the last app you uploaded. 3.8.0.4 introduced new settings in the "Teams Settings" tab, where site admins can customise app ID and name in the manifest file for the Teams app, therefore uploading multiple apps linking to different Moodle sites are possible without modification.
  2. When uninstalling a Moodle plugin properly from the plugins overview page, all data belonging to the plugin, including all its settings, will be deleted. This will not affect Teams tab though, as the tabs are saved in Teams rather than in Moodle. So as long as the Moodle plugins and installed and configured again, the tabs should work.
  3. The issue you described in post at https://github.com/microsoft/o365-moodle/issues/1466#issuecomment-727011891 seems to be an SSO issue. I will need a bit more details:
    • Is normal Moodle login from the login page in web browser (not Teams) working for the user.
    • Teams environment where you see the error (web app? desktop app? mobile?)

Regards, Lai

klovsb commented 3 years ago

Hi @weilai-irl Thanks for your clarification about those messages. We do have multiple Moodle site and would definitely appreciate improvement in managing multiple app ID.

About our scenario, OpenID Connect login at moodle site directly works fine.

We see no error in Teams. What we and some teachers that are more tech savvy found is that, sometimes if we are lucky after we login to O365 through the bot in Team, we can briefly see the list of courses we can add. The list lasts maybe half a second and disappears, replaced with the login bot again. So for people with excellent hand-eye coordination and fast finger and are determined to get the course in their Team Classroom, they may get lucky and able to click on the course and click on add button before it disappers. One of the teachers actually tried for about 20 times and get 1 of his courses in Team.

J

klovsb commented 3 years ago

I test it again this morning on PC in Chrome without logging into moodle site first.

  1. Open Team desktop app
  2. Add the Moodle app
  3. The login popup/bot/api whatever display a message that I have no course to add and the message stayed for only about 1/2 second
  4. The Login to Office365/Login manually prompt is displayed
  5. Click on Login to Office 365 nothing happened
  6. Click on Login manually it displayed the moodle login page
  7. Choose OpenID Connect
  8. A list of course displayed for about 1/2 second and disappeared
  9. The Login to Office365/Login manually prompt is displayed
  10. Clicking on Login to Office 365 nothing happened
  11. Click on Login manually it displayed a message that I am already logged in as myself and prompt to confirm logout
  12. I confirmed logout, it displayed the standard moodle login page
  13. Choose OpenID Connect again, it displayed the Moodle Frontpage (apparently in an iFrame). image
  14. At this point that is no advancing to anything

Then I tried again after I login to the moodle site on the browser first and repeat the steps. This time it displayed the courses for like a second and displayed the Login to Office365/Login manually prompt. After that, it repeated its behaviour as described in steps 9 onward.

It maybe a wild guess but I think somewhere in the SSO process the incorrect login status is set or passed and login prompt displayed again after testing the status.

klovsb commented 3 years ago

I had a teacher test it on his Team in which he had a course added before the plugin broke. When he access the course in Team, the SSO login is not working. He had to use the Login manually inside Team and it took him directly to the course.

klovsb commented 3 years ago

@weilai-irl @nenorojas I have been following other threads with similar reports and thanks @weilai-irl for your follow-up.

While many issues point to it being SSO / authenticate issue because the TeamMoodle login prompt stay unchanged, we noticed that it did change BUT the course list flashes away and returns to the login prompt. Which tells me that authentication did happen. Same behaviour on two different users, one with an OpenID Connect account and one with a manual account on Moodle. If the issue is with authentication, I should not be able to see the course list at all, no matter how briefly before it dissappears. The Moodle manual login account does not use oauth.

If I get myself ready and fast enough, I could click a course and click the save button to successfully add a tab. One of our teachers had actually done that.

And when I tried logging again, it would ask me to confirm logout. That seems to me that I was authenticated already even though I was presented with the login prompt again.

I think the key maybe 'what causes the course list to disappear after showing up briefly?'

We only use the authentication and adding tab to Team manually. We disabled most other part of sync function of the plugin.

Our environment: Windows 2012 R2 MS SQL Server 2012 PHP 7.2.32 on Windows Moodle 3.9.4+ O365 Plugin 3.9.3 build 2020071503

I hope it helps.

klovsb commented 3 years ago

@benzini00 did you get your problem resolve?

weilai-irl commented 3 years ago

Hi all,

The local_o365 releases for Moodle 3.9 and 3.10 that contain improvements in Moodle and Teams integration have finally arrived. The new version should fix most issues in the integration, if not all. The release notes for Moodle 3.9 and Moodle 3.10 are linked.

Please upgrade your plugin local_o365 (and auth_oidc which it depends on) to the latest version and try it out. Please report back any remaining issues found in this issue. The issue will be kept open for one month from today, and will be closed if most issues are confirmed resolved.

Regards, Lai

weilai-irl commented 3 years ago

Issue closed one month after release.