jgraph / drawio

draw.io is a JavaScript, client-side editor for general diagramming.
https://www.drawio.com
Other
22 stars 8 forks source link

Selfhosted under subdirectory won't work with Onedrive #3770

Open VendettaMike opened 1 year ago

VendettaMike commented 1 year ago

Describe the bug We have been running a self-hosted version for some time and are in the process of implementing OneDrive. Our version does not run on the root URL of the host, ie DRAWIO_BASE_URL=https://hostname.servername.com/diagrams/

The OneDriveClient.js file hardcodes the redirect URL's to the root directory: OneDriveClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/microsoft'; OneDriveClient.prototype.pickerRedirectUri = window.location.protocol + '//' + window.location.host + '/onedrive3.html';

This hardcoding prevents the use of running the software in a path other than the root URL.

The application was locally modified to support subdirectories, authorization was approved by the administrator, but a 500 error was thrown. It appears the Java portion is using the root URL as well. Here is a snippet from the Tomcat server:

08-Aug-2023 14:59:56.141 SEVERE [http-nio-8080-exec-109] com.mxgraph.online.AbsAuth.contactOAuthServer AUTH-SERVLET: [https://login.microsoftonline.com/common/oauth2/v2.0/token] ERROR: Server returned HTTP response code: 400 for URL: https://login.microsoftonline.com/common/oauth2/v2.0/token -> {"error":"invalid_client","error_description":"AADSTS500112: The reply address 'https://hostname.servername.com/microsoft' does not match the reply address 'https://hostname.servername.com/diagrams/microsoft' provided when requesting Authorization code.\r\nTrace ID:........}

Expected behavior The software should support OneDrive when self-hosting under non-root URL locations

Screenshots 500 Error after trying to access OneDrive: image

draw.io version (In the Help->About menu of the draw.io editor):

Additional context Application has been successfully setup in Azure and authorization approved by the administrator.

davidjgraph commented 8 months ago

This should work in 24.0.6.

github-actions[bot] commented 3 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.