zoukankan      html  css  js  c++  java
  • oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决方法

    报错信息

    <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

  • 相关阅读:
    uva-321-暴力枚举-隐式图搜索
    uva-704-暴力枚举-双向bfs
    整数的无符号编码和有符号编码
    HDU 5793
    HDU 5730
    HDU 5740
    HDU 5768
    HDU 1194
    HDU 1086
    HDU 5145
  • 原文地址:https://www.cnblogs.com/exmyth/p/15589686.html
Copyright © 2011-2022 走看看