Swagger is not returning authorization token

246 Views Asked by At

Swagger is not returning authorization token! but it's working fine in Postman. Even if I am printing verify token it returns empty string.

My Function Code.

$verified_token = str_replace('Bearer ', '', $request->header('Authorization'));
        return $verified_token;

Swagger Response is empty due to which I cannot do further validations.

Thanks

I have tried reading documentation for swagger but couldn't found any help.

1

There are 1 best solutions below

0
Arshi On BEST ANSWER

Make sure your are defining security field in swagger code. For example if you are using sanctum as middleware define like this.

/**
     * @OA\Get(
     ...
     *  security={ {"sanctum": {} }},
     ...