使用的是auth2的方式进行微服务的授权,
获取到token后调用服务都正常,但是如果服务之间通过feign互相调用,
就会出现token不正确的问题,生产者一方会出现如下警告:
WARN 22880 --- [nio-8200-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Could not fetch user details: class org.springframework.beans.factory.BeanCreationException, Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
springcloud oauth2 微服务之间同feign调用,产生invalid_token
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-