当我尝试将OneDrive插件用于Uppy时,会出现以下错误:
AADSTS900144: The request body must contain the following parameter: 'client_id'.但当我提出这样的请求时:
GET https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope={scope}
&response_type=code&redirect_uri={redirect_uri}我得到了我需要的-授权。
那么如何将client_id添加到请求中呢?
我和uppy.setMeta试过,但没有成功。
我目前使用的代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<title>Uppy</title>
<link href="https://releases.transloadit.com/uppy/v1.27.0/uppy.min.css" rel="stylesheet">
</head>
<body>
<div id="drag-drop-area"></div>
<script src="https://releases.transloadit.com/uppy/v1.27.0/uppy.min.js"></script>
<script>
var uppy = Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
target: '#drag-drop-area'
})
.use(Uppy.GoogleDrive, {target: Uppy.Dashboard, companionUrl: 'http://localhost:3020'})
.use(Uppy.Dropbox, {target: Uppy.Dashboard, companionUrl: 'http://localhost:3020'})
.use(Uppy.OneDrive, {target: Uppy.Dashboard, companionUrl: 'http://localhost:3020'})
uppy.setMeta({
"client_id": "some_id"
})
uppy.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
})
</script>
</body>
</html>发布于 2022-08-01 14:00:31
我要为任何面临同样问题的人留下我所做的事情:
在Azure应用程序注册中将COMPAINON_ONEDRIVE_KEY设置为客户机ID
将COMPANION_ONEDRIVE_SECRET设置为在Azure中生成的秘密的值
将COMPANION_ONEDRIVE_DOMAIN_VALIDATION设置为真
创建一个具有读/写权限的目录,并将其添加到停靠-撰写或正在使用的目录中。
在Azure中,请确保您正在使用试用许可证。还有files.read.all、offline_access和User.Read权限。使用已格式化的权限公开API。
确保重定向URI使用的URL与承载Companion的服务器相同,如下所示:<app-address>/onedrive/redirect
下面是我所用的船坞组合:
version: '3.9'
services:
uppy:
image: transloadit/companion
build:
context: .
dockerfile: Dockerfile
environment:
- NODE_ENV=development
volumes:
- ./output:/app/output
- ./packages/@uppy/companion/src:/app/src
- ./packages/@uppy/companion/node_modules:/app/node_modules
- ./packages/@uppy/companion/nodemon.json:/app/nodemon.json
- /mnt/uppy-server-data:/mnt/uppy-server-data
ports:
- "3020:3020"
command: "/app/src/standalone/start-server.js --config nodemon.json"
env_file:
- .envDockerfile在回购中。
https://stackoverflow.com/questions/73178214
复制相似问题