Nextcloud报错 Error transferring /login/v2/poll – server replied: Bad Request

目录 文章

Windows 10 nextcloud客户端连接登录时出啊下以下报错:

访问“token”端点时出错:
Error transferring https://www.orcy.net.cn:12345/login/v2/poll - server replied: Bad Request

解决办法:

1.卸载Windows上安装的nextcloud客户端,重新下载安装,或者更换一下其他版本尝试。

大部分出现此问题的案例可以使用此方法解决

2.检查配置文件

vi config.php

查看是否有以下内容

  'overwrite.cli.url' => 'https://www.orcy.net.cn',
  'overwriteprotocol' => 'https',

如果没有以上内容,请在配置文件添加,重载web服务器配置或者重启后再次尝试

3.nextcloud服务在反向代理后

请修改nginx反代服务器设置,添加以下内容

proxy_set_header Host $http_host;
#I use this to prevent port change on redirect
#alternatively use the common
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#this preserves the initial protocol, the https…

官方文档相关说明

Login flow v2

While the login flow works very nice in a lot of cases there are especially on dekstop application certain hurdles. Special proxy configuration, client side certificates and the likes can cause trouble. To solve this we have come up with a second login flow that uses the users default webbrowser to authenticate. Thus ensuring that if they can login via the web they can also login in the client.

To initiate a login do an anonymous POST request

curl -X POST https://cloud.example.com/index.php/login/v2

This will return a json object like

{
    "poll":{
        "token":"mQUYQdffOSAMJYtm8pVpkOsVqXt5hglnuSpO5EMbgJMNEPFGaiDe8OUjvrJ2WcYcBSLgqynu9jaPFvZHMl83ybMvp6aDIDARjTFIBpRWod6p32fL9LIpIStvc6k8Wrs1",
        "endpoint":"https:\/\/cloud.example.com\/login\/v2\/poll"
    },
    "login":"https:\/\/cloud.example.com\/login\/v2\/flow\/guyjGtcKPTKCi4epIRIupIexgJ8wNInMFSfHabACRPZUkmEaWZSM54bFkFuzWksbps7jmTFQjeskLpyJXyhpHlgK8sZBn9HXLXjohIx5iXgJKdOkkZTYCzUWHlsg3YFg"
}

The url in login should be opened in the default browser, this is where the user will follow the login procedure. The program should directly start polling the poll endpoint:

curl -X POST https://cloud.example.com/login/v2/poll -d "token=mQUYQdffOSAMJYtm8pVpkOsVqXt5hglnuSpO5EMbgJMNEPFGaiDe8OUjvrJ2WcYcBSLgqynu9jaPFvZHMl83ybMvp6aDIDARjTFIBpRWod6p32fL9LIpIStvc6k8Wrs1"

This will return a 404 until authentication is done. Once a 200 is returned it is another json object.

{
    "server":"https:\/\/cloud.example.com",
    "loginName":"username",
    "appPassword":"yKTVA4zgxjfivy52WqD8kW3M2pKGQr6srmUXMipRdunxjPFripJn0GMfmtNOqOolYSuJ6sCN"
}

Use the server and the provided credentials to connect. Note that the 200 will only be returned once.

>>本文为下一朵云的原创文章,转载请附上原文出处链接及本声明
>>原文链接地址:Nextcloud报错 Error transferring /login/v2/poll – server replied: Bad Request

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注