SSO using Moodle Teams Tab Integration does not work #2688
Labels
Feature - Teams SSO
Issue type - bug
Bugs in existing code that needs to be fixed.
Plugin - local_o365
Status - In Progress
WIP
Milestone
I tried to get SSO for the Moodle Teams Tab Integration to work but without success. Unfortunately after many hours of debugging I decided to raise an issue here.
My setup
Situation
After a user clicks on the Moodle Tab in Teams instead of seamless login a prompt shows with the following buttons:
The button "Bei Microsoft 365 anmelden" opens a pop up using sso_start.php and stuck with the following errors in browser console:
lib/1.0.17/js/adal.min.js'
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.The button "Login manually" shows me the normal Moodle Login page where I can click on the Microsoft Login button which authenticates me successfully to Moodle. In other word the standard SSO login works without issues. After I establish a session using "Login manually" the tab redirects me also successfully, probably due to existing cookies.
Analysis
I analyzed why the seamless login using Moodle Tab Integration does not work. In the browser debug console I get a 401 HTTP response on sso_login.php. I then narrowed down the issue using some debug statements in sso_login.php and lib.php.
It seems that the Moodle Tab sends an http header 'authorization' in a JWT format (without bearer prefix) but the code in lib.php expects that the header 'Authorization' starts with 'Bearer '
$authtoken = substr($headers['Authorization'], 7);
When I decode the JWT token sent to sso_login.php it looks good to me.
Question
The text was updated successfully, but these errors were encountered: