# How to use Swagger UI to test xibo apis?

**URL:** https://community.xibo.org.uk/t/how-to-use-swagger-ui-to-test-xibo-apis/25727
**Category:** Developer Experience
**Created:** [September 10, 2021, 4:48am UTC](https://community.xibo.org.uk/t/how-to-use-swagger-ui-to-test-xibo-apis/25727 "2021-09-10T04:48:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mondwan](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/mondwan/32/11208_2.png) [@mondwan](https://community.xibo.org.uk/u/mondwan)
#### Post date: [September 10, 2021, 4:48am UTC](https://community.xibo.org.uk/t/how-to-use-swagger-ui-to-test-xibo-apis/25727/1 "2021-09-10T04:48:27Z")

</div>

# 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

```php
$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.

- But, I still cannot gain `access_token` via the `Auhtorize` button

- The request from swagger UI looks like below, which does not include the client\_secret

 ![image](https://community.xibo.org.uk/uploads/default/original/2X/8/8941fee8197132991b069f2575009aab824eb301.png)

- 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
