API Tools Swagger Documentation Missing Authorisation


I see in the documentation Laminas API Tools that there is an ‘Authorization’ field in the header of the image included in this page.

I accept that the image is of Apigility, but should I expect similar from API Tools?

I set up a api-tools-skeleton, added the laminas-api-tools/api-tools-documentation-swagger library and created a service with using the basic authentication.

At this stage, should I expected the ‘Authorization’ field to be accessible in the swagger documentation or how to I get it to work?

Hey @vigcraig ,

As far as I can tell from your screenshots, you have created a Basic Auth Adapter basictest (basic). Have you created and stored the corresponding htpasswd file for your Basic Auth Adapter as described here?

If so, you can define the authorization header with a combination of username and password of one of the mentioned users in the htpasswd file.

Example header: Authorization: Basic <base64 encoded credentials>.
The RFC 7617 says basic auth the credentials have to be simply base64 encoded. Just concatenate username and password with a “:” and encode it.

$authentication = "Basic " . base64_encode($username . ':' . $password);
Add the resulting string to the swagger authorization header value.

Hi @ezkimo, thanks for coming back to me.

I had set up the basic auth adapter as per the docs, I just don’t understand what I need to do to get the Authorisation text field to appear in the first screenshot.

After further research, this seems to be a known issue: "Enter Authorization header value" input field missing · Issue #5 · laminas-api-tools/api-tools-documentation-swagger · GitHub

and more recently here:

Unless someone has a workaround, I am beginning to think that I can’t use this library for my swagger documentation