首页 > 编程语言 > 详细

oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决方法

时间:2018-05-13 11:14:28      阅读:2711      评论:0      收藏:0      [点我收藏+]

报错信息

<MethodNotAllowed>
<error>method_not_allowed</error>
<error_description>Request method &#39;GET&#39; not supported</error_description>
</MethodNotAllowed>

39是单引号

原因

默认只支持post

解决方法

  1. 下载安装postman工具(或其他post工具)
    使用post调用
    技术分享图片

  2. 代码增加get的方法

    @Configuration
    public class OAuthSecurityConfig extends AuthorizationServerConfigurerAdapter {
    ...
    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        ...
        endpoints.allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST);// add get method
        ...
    
        endpoints.tokenServices(tokenServices);
    }
    ...
    }

参考资料

stackoverflow
csdn blog

oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决方法

原文:https://www.cnblogs.com/ouyida3/p/9031328.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!