not allowed to read the swagger of a microservice from the gateway

419 Views Asked by At

the gateway was generated by jhipster 7.0.1, and to that I added the dependency "springfox-boot-starter" for io.springfox.

<dependency>
     <groupId>io.springfox</groupId>
     <artifactId>springfox-boot-starter</artifactId>
     <version>3.0.0</version>
</dependency>
<dependency>
     <groupId>io.springfox</groupId>
     <artifactId>springfox-swagger-ui</artifactId>
     <version>3.0.0</version>
</dependency>

Being in the ui i can see the gateway documentation and i can also see the microservices in my architecture but when i try to click on a microservice i get the following error

Failed to load API definition.

Fetch error Unauthorized http://<url>/services/<servicename>/v3/api-docs

1

There are 1 best solutions below

0
On

I was able to have a solution to my problem, the trick is that at the gateway level to route the request asks for the token and when it does not see it, it returns an exception. so what I did is instead of returning an exception, it returns an empty test and everything passes very well