访问 “oauth/token” ,报错:Request method 'POST' not supported
时间: 2023-11-17 18:00:15 浏览: 51
这个问题可能是因为你的请求方式不正确导致的。根据引用中提到的信息,Spring Cloud OAuth2项目中访问获取access_token票证的端点/oauth/token时默认是不支持GET请求的,只支持POST请求。因此,如果你使用了GET请求,就会出现“Request method 'POST' not supported”的错误提示。解决方法是将请求方式改为POST请求即可。
相关问题
xhr.js:210 POST http://localhost:9527/stage-api/auth/oauth/token 400 (Bad Request)
这个错误提示表明你的应用程序尝试向本地主机上的某个端口发送一个POST请求,该请求的目标是 /stage-api/auth/oauth/token。但是,服务器返回了一个“400 Bad Request”错误,这意味着服务器无法理解或处理请求。可能的原因包括请求格式不正确、缺少必需的参数或无效的凭据。你需要检查你的请求参数和凭据,以确定是否出现了错误。
vue配置完代理服务器之后出现两个Xapi?http://localhost:8092/Xapi/Xapi/qdport-auth/oauth/token
出现两个`Xapi`路径的原因可能是你在`proxyTable`中设置了重写路径(`pathRewrite`),但是重写路径中没有将原始的`/Xapi`路径去掉,导致最终请求路径中出现了两个`Xapi`。
可以将`pathRewrite`中的配置修改为:
```javascript
pathRewrite: {
'^/Xapi': ''
}
```
这样就可以将原始请求路径中的`/Xapi`去掉,避免出现重复路径的问题。
完整的`proxyTable`配置代码如下:
```javascript
proxyTable: {
'/Xapi': {
target: 'http://localhost:8092',
changeOrigin: true,
pathRewrite: {
'^/Xapi': ''
}
}
}
```
这样设置之后,你的请求地址应该为:`http://localhost:8092/qdport-auth/oauth/token`,其中不再包含重复的`Xapi`路径。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)