5

I'm using Spring Feign and Oauth 2.0

My application has

  • 1 Api gateway with @EnableOAuth2Sso
  • 2 Services with @EnableResourceServer

When I call an api of an service from the other service, I get this exception.

feign.FeignException: status 401 reading TestFeign#test(); content:
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}

How to call an api of an service from the other service?

Tran Thien Chien
  • 643
  • 2
  • 6
  • 17

1 Answers1

0

For services you can use these dependency.

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
  <groupId>io.jmnarloch</groupId>
  <artifactId>feign-oauth2-spring-cloud-starter</artifactId>
  <version>1.0.0</version>
</dependency>

This way does not work for api gateway!!!

Yaqub Abdi
  • 11
  • 2