Skip to content

Commit bbc5ea0

Browse files
committed
Update readme
1 parent 11c987d commit bbc5ea0

1 file changed

Lines changed: 47 additions & 47 deletions

File tree

README.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ The latest version is available on npm:
2828
npm install @reportportal/client-javascript
2929
```
3030

31-
## Usage examples
32-
33-
### Using API Key Authentication
31+
## Usage example
3432

3533
```javascript
3634
const RPClient = require('@reportportal/client-javascript');
@@ -50,7 +48,41 @@ rpClient.checkConnect().then(() => {
5048
});
5149
```
5250

53-
### Using OAuth 2.0 Password Grant
51+
## Configuration
52+
53+
When creating a client instance, you need to specify the following options.
54+
55+
### Authentication Options
56+
57+
The client supports two authentication methods:
58+
1. **API Key Authentication** (default)
59+
2. **OAuth 2.0 Password Grant** (recommended for enhanced security)
60+
61+
**Note:**\
62+
If both authentication methods are provided, OAuth 2.0 will be used.\
63+
Either API key or complete OAuth 2.0 configuration is required to connect to ReportPortal.
64+
65+
| Option | Necessity | Default | Description |
66+
|--------|-------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
67+
| apiKey | Conditional | | User's ReportPortal API key from which you want to send requests. It can be found on the profile page of this user. *Required only if OAuth is not configured. |
68+
| oauth | Conditional | | OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key. See OAuth Configuration below. |
69+
70+
#### OAuth Configuration
71+
72+
The `oauth` object supports the following properties:
73+
74+
| Property | Necessity | Default | Description |
75+
|-----------------------|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
76+
| tokenEndpoint | Required | | OAuth 2.0 token endpoint URL for password grant flow. |
77+
| username | Required | | Username for OAuth 2.0 password grant. |
78+
| password | Required | | Password for OAuth 2.0 password grant. |
79+
| clientId | Required | | OAuth 2.0 client ID. |
80+
| clientSecret | Optional | | OAuth 2.0 client secret (optional, depending on your OAuth server configuration). |
81+
| scope | Optional | | OAuth 2.0 scope (optional, space-separated list of scopes). |
82+
83+
**Note:** The OAuth interceptor automatically handles token refresh when the token is about to expire (1 minute before expiration).
84+
85+
##### OAuth 2.0 configuration example
5486

5587
```javascript
5688
const RPClient = require('@reportportal/client-javascript');
@@ -77,52 +109,20 @@ rpClient.checkConnect().then(() => {
77109
});
78110
```
79111

80-
**Note:** The OAuth interceptor automatically handles token refresh when the token is about to expire (1 minute before expiration).
81-
82-
## Configuration
83-
84-
When creating a client instance, you need to specify the following options:
85-
86-
### Authentication Options
87-
88-
The client supports two authentication methods:
89-
1. **API Key Authentication** (default)
90-
2. **OAuth 2.0 Password Grant** (recommended for enhanced security)
91-
92-
**Note:** If both authentication methods are provided, OAuth 2.0 will be used.
93-
94-
| Option | Necessity | Default | Description |
95-
|-----------------------|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
96-
| apiKey | Required* | | User's reportportal token from which you want to send requests. It can be found on the profile page of this user. *Required only if OAuth is not configured. |
97-
| oauth | Optional | | OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key. See OAuth Configuration below. |
98-
99-
#### OAuth Configuration
100-
101-
The `oauth` object supports the following properties:
102-
103-
| Property | Necessity | Default | Description |
104-
|-----------------------|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
105-
| tokenEndpoint | Required | | OAuth 2.0 token endpoint URL for password grant flow. |
106-
| username | Required | | Username for OAuth 2.0 password grant. |
107-
| password | Required | | Password for OAuth 2.0 password grant. |
108-
| clientId | Required | | OAuth 2.0 client ID. |
109-
| clientSecret | Optional | | OAuth 2.0 client secret (optional, depending on your OAuth server configuration). |
110-
| scope | Optional | | OAuth 2.0 scope (optional, space-separated list of scopes). |
111-
112112
### General Options
113113

114-
| Option | Necessity | Default | Description |
115-
|-----------------------|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
116-
| endpoint | Required | | URL of your server. For example, if you visit the page at 'https://server:8080/ui', then endpoint will be equal to 'https://server:8080/api/v1'. |
117-
| launch | Required | | Name of the launch at creation. |
118-
| project | Required | | The name of the project in which the launches will be created. |
119-
| headers | Optional | {} | The object with custom headers for internal http client. |
120-
| debug | Optional | false | This flag allows seeing the logs of the client. Useful for debugging. |
121-
| isLaunchMergeRequired | Optional | false | Allows client to merge launches into one at the end of the run via saving their UUIDs to the temp files at filesystem. At the end of the run launches can be merged using `mergeLaunches` method. Temp file format: `rplaunch-${launch_uuid}.tmp`. |
114+
| Option | Necessity | Default | Description |
115+
|-----------------------|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
116+
| endpoint | Required | | URL of your server. For example, if you visit the page at 'https://server:8080/ui', then endpoint will be equal to 'https://server:8080/api/v1'. |
117+
| launch | Required | | Name of the launch at creation. |
118+
| project | Required | | The name of the project in which the launches will be created. |
119+
| headers | Optional | {} | The object with custom headers for internal http client. |
120+
| debug | Optional | false | This flag allows seeing the logs of the client. Useful for debugging. |
121+
| isLaunchMergeRequired | Optional | false | Allows client to merge launches into one at the end of the run via saving their UUIDs to the temp files at filesystem. At the end of the run launches can be merged using `mergeLaunches` method. Temp file format: `rplaunch-${launch_uuid}.tmp`. |
122122
| restClientConfig | Optional | Not set | `axios` like http client [config](https://github.com/axios/axios#request-config). May contain `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, and other client options eg. `timeout`. For debugging and displaying logs you can set `debug: true`. Use the `retry` property (number or [`axios-retry`](https://github.com/softonic/axios-retry#options) config) to customise automatic retries. |
123-
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
124-
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
125-
| token | Deprecated | Not set | Use `apiKey` instead. |
123+
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
124+
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
125+
| token | Deprecated | Not set | Use `apiKey` or `oauth` instead. |
126126

127127
## Asynchronous reporting
128128

0 commit comments

Comments
 (0)