File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,14 @@ curl --location --request POST 'rest_gateway:4444/stations/<station_name>/produc
157157--data-raw '{"message": "New Message"}'
158158```
159159
160+ #### If you don't have the option to add the authorization header, you can send the JWT via query parameters:
161+
162+ ```
163+ curl --location --request POST 'rest_gateway:4444/stations/<station_name>/produce/single?authorization=eyJhbGciOiJIU**********.e30.4KOGRhUaqvm-qSHnmMwX5VrLKsvHo33u3UdJ0qYP0kI' \
164+ --header 'Content-Type: application/json' \
165+ --data-raw '{"message": "New Message"}'
166+ ```
167+
160168Expected output:
161169
162170```
Original file line number Diff line number Diff line change @@ -71,10 +71,13 @@ func Authenticate(c *fiber.Ctx) error {
7171 headers := c .GetReqHeaders ()
7272 tokenString , err := extractToken (headers ["Authorization" ])
7373 if err != nil || tokenString == "" {
74- log .Warnf ("Authentication error - jwt token is missing" )
75- return c .Status (fiber .StatusUnauthorized ).JSON (fiber.Map {
76- "message" : "Unauthorized" ,
77- })
74+ tokenString = c .Query ("authorization" )
75+ if tokenString == "" { // fallback - get the token from the query params
76+ log .Warnf ("Authentication error - jwt token is missing" )
77+ return c .Status (fiber .StatusUnauthorized ).JSON (fiber.Map {
78+ "message" : "Unauthorized" ,
79+ })
80+ }
7881 }
7982 err = verifyToken (tokenString , configuration .JWT_SECRET )
8083 if err != nil {
You can’t perform that action at this time.
0 commit comments