Issue with Swagger UI in ChirpStack V4

Hi all,
The chirpstack V4 docker installation comes with a very convenient API REST Interface and a Swagger UI to try it out. The swagger UI (v4.2.0) is available on port 8090 of the chirpstack server [ http://MY_SERVER.:8090/ ]. When I first tried it, it kept telling me this:

image

Indeed, the generated Curl command was this one:

curl -X ‘GET’
‘http://MY_SERVER:8090/api/applications’
-H ‘accept: application/json’
-H ‘Grpc-Metadata-Authorization: eyJ0eC74…WhojLY’

Whereas it should have been that one:

curl -X ‘GET’
‘http://MY_SERVER:8090/api/applications’
-H ‘accept: application/json’
-H ‘Grpc-Metadata-Authorization: Bearer eyJ0eC74…WhojLY’

In the first request, Bearer is missing. The second request works fine but obviously I need to copy the command, edit and send it from a terminal. Which is fine but removes all the convenience of Swagger.
I’m thinking of a bug but as no one has reported it I’m wondering if I haven’t missed something.

Has anyone been able to make it works without this issue?

Thanks for your help.

I think this is an artifact of grpc-gateway’s OpenAPI generator. I don’t use the ChirpStack REST API, but in my own platforms using Swagger via grpc-gateway, I just preface the key with “Bearer” when typing/pasting it into the Authorize box. While you could certainly hack it up a bit to change headers, it seems to work well enough, and I put a note in the generated Swagger JSON as a reminder.

1 Like

Grpc-Metadata-Authorization is not correct.
Try the below header.
“X-Authorization”: “Bearer token…"

The token is the API key btw.

The REST API works fine.

Great, I didn’t think of that trick but it perfectly works. Thanks a lot for your help !

1 Like