Bladeren bron

Adding support of global bearer token variable.

This update brings global bearer token setting in the postman file.
If you set `use_value` as `{{token}}` in the scribe config file it'll automatically populate it when postman file is generated.

In you postman variables you can set that token automatically when sending login request using Postman's `Tests`. You can set this JS code in Tests tab and JWT token will be automatically populated and used globally by the API.
```javascript
var jsonData = JSON.parse(responseBody);
pm.environment.set("token", jsonData.login.access_token);
```
Irakli Tchitadze 2 jaren geleden
bovenliggende
commit
22acd18993
1 gewijzigde bestanden met toevoegingen van 7 en 0 verwijderingen
  1. 7 0
      src/Writing/PostmanCollectionWriter.php

+ 7 - 0
src/Writing/PostmanCollectionWriter.php

@@ -77,6 +77,13 @@ class PostmanCollectionWriter
             ],
             "bearer" => [
                 'type' => 'bearer',
+                'bearer' => [
+                    [
+                        'key'   => $this->config->get('auth.name'),
+                        'value' => $this->config->get('auth.use_value'),
+                        'type'  => 'string',
+                    ],
+                ],
             ],
             default => [
                 'type' => 'apikey',