How to use Swagger UI to test xibo apis?

In short

  • I need help on using swagger UI to testing xibo apis.
    • How to setup fill in my swagger ui in xibo-cms\lib\Entity\Application.php:$redirectUris?
  • Or, how to code the swagger ui doc to follow the practice in xibo-cms\cypress\support\commands.js
    • I can only change the scheme type to client_credentials. But, I have no clues on filling in rest of the arguments in swagger ui

Detail

  • There is no implementation for method option on /api/authorize/access_token which is mandatory on swagger ui page
    • ref: web/api/authorize/index.php

So, I fill in my implementation for that

$app->options('/access_token', function (Request $request, Response $response) use ($app) {
    $httpResponse = $response->withStatus(200);
    return $httpResponse;
});
  • I noticed that you guys are trying to use Swagger/SecurityScheme to gain the access_token? for rest of the API.

    • ref: xibo-cms\lib\routes.php
  • But, I still cannot gain access_token via the Auhtorize button

    • I follow guide here to create the client_id & client_secret as requested
    • I got this error from authorize {"error":"invalid_client","error_description":"Client authentication failed","message":"Client authentication failed"}
    • See below screen captures for further investigation
  • The request from swagger UI looks like below, which does not include the client_secret

  • It fails on
    • xibo-cms\web\api\authorize\index.php
      • $authRequest = $server->validateAuthorizationRequest($request);
    • and finally fail on xibo-cms\vendor\league\oauth2-server\src\Grant\AbstractGrant.php
      • $validator->validateRedirectUri($redirectUri)
        • Due to my swagger uri is not a xibo-cms\lib\Entity\Application.php:$redirectUris