最近在折腾密码管理软件,相中了keepass。
使用它的数据库的开源软件有很多,选择了keeweb(js写的,可以是桌面、Web应用,跨平台很好),
以及keepass2android(Android端)。
倒腾了许久,最终数据同步用的是坚果云的Webdav。
但是有个缺点,因为浏览器请求会带上Origin等头部,因为跨域安全问题导致Web应用无法使用坚果云。 
所以Web应用只能尝试使用微软的Onedrive。
问题复现
- 参照Wiki进行Onedrive的配置
 - 单页应用直接copy的gh-pages分支
 - 这里采取的是在url参数里面指定配置路径
    
- https://your-keeweb-deployment-url/?config=your-config.json
 - json的内容为
        
{ "settings": { "onedriveClientId": "xxx", } } 
 - 最后在浏览器Web应用里使用OneDrive时,报错
    
- log如下:
        
[storage-onedrive] OAuth error invalid_request The request is not valid for the application's 'userAudience' configuration. In order to use /common/ endpoint, the application must not be configured with 'Consumer' as the user audience. The userAudience should be configured with 'All' to use /common/ endpoint. xxxxx.xxx.com:1:450893 [storage-onedrive] OAuth error popup closed 
 - log如下:
        
 
问题分析
- 在dotnet/AspNetCore.Docs#19795找到答案:
    
- ×    https://login.microsoftonline.com/
common/oauth2/v2.0/authorize - √ https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize
 
 - ×    https://login.microsoftonline.com/
 - 在keeweb项目中,找到类似问题。。。只能说文档不够完善😳
 
问题解决
修改配置
{
    "settings": {
        "onedriveClientId": "xxx",
        "onedriveTenantId": "consumers"
    }
}