Selfhosted under subdirectory won't work with Onedrive
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
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:
draw.io version (In the Help->About menu of the draw.io editor):
- draw.io version 21.1.4
Additional context Application has been successfully setup in Azure and authorization approved by the administrator.
This should work in 24.0.6.