mevdschee / mevdschee/php-crud-api

Authentication to see documentation

Open
#1,032 2 comments 0 reactions 1 assignee View on GitHub

@mevdschee is already working on this.

Since May 17, 2024.

enhancement
Dominant language
PHP
Stars
3.7k
Forks
1k
Avg merge
1h 55m
Merged PRs (30d)
7

Description

I think there is some problems when you need to share API documentation using auth.
I'm using

$config = new Config([
  'username' => 'aaa',
  'password' => 'bbb',
  'database' => 'ccc',
  'tables' => 'products',
  'openApiBase' => json_encode(array(
    "info" => array(
      "title" => "Title",
      "version" => "1.0.0",
    ),
    "components" => array(
      "securitySchemes" => array(
        "ApiKeyAuth" => array(
          "type" => "apiKey", 
          "in" => "header",
          "name" => "X-API-Key",
        )
      )
    )
  )),
  // auth 
  'apiKeyAuth.mode'=> 'required',
  'middlewares' => 'cors,apiKeyAuth',
  'apiKeyAuth.keys' => 'Vp7LxyEpfwYjSVm',
]);

In https://petstore.swagger.io/?url=https://<your domain>/api.php/openapi there is no way to pass the auth-key.
I think you should define in json the option to enable auth also in swagger (or similar).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.