microsoftarchive / Learn-LTI

Access the Microsoft Learn http://docs.microsoft.com/learn Catalog of Learning Paths and Modules directly from your Learning Management Systems using the Microsoft Learn LTI application
https://microsoft.github.io/Learn-LTI/
MIT License
127 stars 50 forks source link

401 Unauthorized in CreateOrUpdateAssignment, cannot update or publish assignment #188

Closed aazswapnil closed 2 years ago

aazswapnil commented 2 years ago

We have followed through the guide and deployed the Learn-LTI tool in our Azure subscription, and set up the external tool in Canvas LMS. Now we are trying to create an assignment following the educator's guide. When we create the assignment in canvas, and launch the tool in new window, we go to the "External Tool Template - Microsoft Learn" page where we can edit and add activities and publish, and it updates and publishes correctly, until we close the window. If we close the window, and open the assignment again from canvas, the activity shows up unpublished, and without any saved details.

Looking at the function trace for the assignment function app on CreateOrUpdateAssignment and PublishAsignment function shows 401 code for each attempt at updating or publishing the assignment. The chrome DevTools network tab also agrees, showing 401 codes for each POST request with the assignment details.

However, function trace for users function app shows code 200 for each request for getting the user data. The user we are currently testing with is a "Teacher" in Canvas LMS, as well as the Subscription owner in the Azure, and has the same email address in Azure and LMS. The /me reply on DevTools shows correct email address and details during each attempt.

aazswapnil commented 2 years ago

Looking in the DevTools console we see this following message pop up when the tool is loaded: Uncaught InteractionRequiredAuthError: AADSTS65001: The user or administrator has not consented to use the application with ID 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX' named 'MS-Learn-Lti-Tool-App'. Send an interactive authorization request for this user and resource.

Could this be a reason for the users being unauthorized in the app? But as we mentioned, the "users" function app gets the user data, and the /me reply on DevTools does show correct user information.

leestott commented 2 years ago

@aazswapnil please see https://github.com/microsoft/Learn-LTI/blob/main/docs/TROUBLESHOOTING.md within the troubleshooting guide search for 401 there a number of debugging steps

leestott commented 2 years ago

@aazswapnil please see https://stackoverflow.com/questions/59282141/aadsts65001-the-user-or-administrator-has-not-consented-to-use-the-application are you running Azure B2C? or a single AAD tenant?

leestott commented 2 years ago

@aazswapnil closing this issue as no updates since July

Please reopen this issue if your still having issues.