Spring cloud zuul 整合 oauth2 获取token 401 问题

如果是直接访问oauth服务获取token 返回401 应该是你的请求headers中少了Authorization :Basic client_id:client_secret      (client_id:client_secret  须base64 加密)  或者 将 client_id与client_secret 添加到请求参数中

通过zuul访问auth服务401 则是 zuul 对routes 的Cookies和Headers 做了过滤,默认会把请求中的

Cookie,Set-Cookie,Authorization 参数过滤掉,不会转发到下游服务 所以如下配置:

application.yml. 

 zuul:
  routes:
    auth-server: //auth服务 spring-application-name
      path: /auth/**
      sensitiveHeaders: 

猜你喜欢

转载自blog.csdn.net/qq_37306234/article/details/85229829