Skip to content

Commit 89ab3a6

Browse files
chore: update readme
Co-authored-by: Ness Li <[email protected]>
1 parent 30a5bf9 commit 89ab3a6

File tree

3 files changed

+5
-53
lines changed

3 files changed

+5
-53
lines changed

README.md

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ Usability, consistency, and performance are key focuses of jira.js, and it also
2121
- [Documentation](#documentation)
2222
- [Usage](#usage)
2323
- [Authentication](#authentication)
24-
- [Basic](#basic-authentication)
24+
- [Email and ApiToken](#email-and-api-token)
2525
- [OAuth 2.0](#oauth-20)
26-
- [Personal access token](#personal-access-token)
2726
- [Error handling](#error-handling)
2827
- [Example and using algorithm](#example-and-using-algorithm)
2928
- [Decreasing Webpack bundle size](#decreasing-webpack-bundle-size)
@@ -56,27 +55,11 @@ You can find the documentation [here](https://mrrefactoring.github.io/jira.js/).
5655

5756
There are several types of authentication to gain access to the Jira API. Let's take a look at a few of them below:
5857

59-
##### [Basic authentication](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/)
58+
##### Email and API Token
6059

61-
Basic authentication allows you to log in with credentials. You can use username and password, but this login method is not supported in the online version and most standalone versions, so it's better to release API Token. Read how to do it [here](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) and use it together with email.
60+
To create an API Token, use this link: [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
6261

63-
Username and password example:
64-
65-
```typescript
66-
import { Version3Client } from 'jira.js';
67-
68-
const client = new Version3Client({
69-
host: 'https://your-domain.atlassian.net',
70-
authentication: {
71-
basic: {
72-
username: 'YOUR_USERNAME',
73-
password: 'YOUR_PASSWORD',
74-
},
75-
},
76-
});
77-
```
78-
79-
Email and API Token example:
62+
Example of usage
8063

8164
```typescript
8265
import { Version3Client } from 'jira.js';
@@ -111,20 +94,6 @@ const client = new Version3Client({
11194
});
11295
```
11396

114-
##### [Personal access token](https://id.atlassian.com/manage-profile/security/api-tokens)
115-
116-
To create a personal access token, use this link: [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
117-
118-
```typescript
119-
import { Version3Client } from 'jira.js';
120-
121-
const client = new Version3Client({
122-
host: 'https://your-domain.atlassian.net',
123-
authentication: {
124-
personalAccessToken: 'secrectPAT',
125-
},
126-
});
127-
```
12897

12998
#### Error handling
13099
Starting from version 4.0.0, the library has a new error handling system.
@@ -152,7 +121,7 @@ try {
152121
console.log(error);
153122
}
154123
}
155-
````
124+
```
156125

157126
#### Example and using algorithm
158127

src/services/authenticationService/getAuthenticationToken.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,5 @@ export async function getAuthenticationToken(
2020
return createOAuth2AuthenticationToken(authentication.oauth2);
2121
}
2222

23-
if (authentication.personalAccessToken) {
24-
return createPATAuthentication(authentication.personalAccessToken);
25-
}
26-
2723
return undefined;
2824
}

tests/unit/services/authenticationService.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ test('should return undefined when authentication does not used', async ({ expec
1010
expect(token).toBe(undefined);
1111
});
1212

13-
test('should return Basic authentication token for password case', async ({ expect }) => {
14-
const authentication: Config.Authentication = {
15-
basic: {
16-
username: 'test_username',
17-
password: 'test_password',
18-
},
19-
};
20-
21-
const token = await getAuthenticationToken(authentication);
22-
23-
expect(token).toBe('Basic dGVzdF91c2VybmFtZTp0ZXN0X3Bhc3N3b3Jk');
24-
});
25-
2613
test('should return Basic authentication token for apiToken case', async ({ expect }) => {
2714
const authentication: Config.Authentication = {
2815
basic: {

0 commit comments

Comments
 (0)