Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 66f76c2

Browse files
Improve README
1 parent 720d777 commit 66f76c2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Wrapper library for Topcoder Submission API
1010
"topcoder-submission-api-wrapper": "topcoder-platform/topcoder-submission-api-wrapper.git"
1111
```
1212

13-
2. Create an instance of this wrapper with the configuration variables listed below
13+
2. Create an instance of this wrapper with any one of the approaches listed below, depending on your use case
14+
15+
**M2M Authentication Configuration:**
1416

1517
```javascript
1618
const submissionApi = require('topcoder-submission-api-wrapper')
@@ -20,7 +22,6 @@ Wrapper library for Topcoder Submission API
2022
'AUTH0_PROXY_SERVER_URL']))
2123
```
2224

23-
**M2M Authentication Configuration:**
2425
- AUTH0_URL - the auth0 url
2526
- AUTH0_AUDIENCE - the auth0 audience
2627
- TOKEN_CACHE_TIME - (optional) the token cache time
@@ -32,27 +33,29 @@ Wrapper library for Topcoder Submission API
3233
- PER_PAGE - the page size
3334
- MAX_PAGE_SIZE - the max number of page size
3435

36+
**User Credentials Authentication Configuration:**
37+
3538
```javascript
3639
const submissionApiUserCredentialsClient = submissionApi(_.pick(config,
3740
['USERNAME', 'PASSWORD', 'TC_AUTHN_URL', 'TC_AUTHZ_URL', 'TC_CLIENT_ID',
3841
'TC_CLIENT_V2CONNECTION', 'SUBMISSION_API_URL']))
3942
```
4043

41-
**User Credentials Authentication Configuration:**
4244
- USERNAME - Topcoder handle
4345
- PASSWORD - Topcoder password
4446
- TC_AUTHN_URL - OAUTH2 token URL, e.g. `https://topcoder.auth0.com/oauth/ro` or for dev `https://topcoder-dev.auth0.com/oauth/ro`
4547
- TC_AUTHZ_URL - Topcoder API token URL, e.g. `https://api.topcoder.com/v3/authorizations` or for dev `https://api.topcoder-dev.com/v3/authorizations`
4648
- TC_CLIENT_ID - OAUTH2 Client ID, e.g. `6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P` or for dev `JFDo7HMkf0q2CkVFHojy3zHWafziprhT`
47-
- TC_CLIENT_V2CONNECTION - The OAUTH2 Client data source, e.g. `TC-User-Database`
49+
- TC_CLIENT_V2CONNECTION - The OAUTH2 Client data source, e.g. `LDAP` or for dev `TC-User-Database`
4850
- SUBMISSION_API_URL - Topcoder V5 Submission API URL. E.g. `https://api.topcoder.com/v5` or for dev `https://api.topcoder-dev.com/v5`
4951

52+
**JWT Method Argument Authentication Configuration:**
53+
5054
```javascript
5155
const submissionJwtMethodArgClient = submissionApi(_.pick(config,
5256
['SUBMISSION_API_URL']))
5357
```
5458

55-
**JWT Method Argument Authentication Configuration:**
5659
- SUBMISSION_API_URL - Topcoder V5 Submission API URL. E.g. `https://api.topcoder.com/v5` or for dev `https://api.topcoder-dev.com/v5`
5760

5861
3. Every function in this wrapper will return a promise, Handling promises is at the caller end. Call the functions with appropriate arguments
@@ -136,7 +139,7 @@ Method | HTTP request | Description
136139

137140
## Authorization
138141

139-
The wrapper internally generates a **JWT token using Auth0 credentials** and pass it in the `Authorization` header.
142+
The wrapper internally generates the JWT token based on the method used when initialising the wrapper (m2m v/s user) or uses the jwt passed during method invocation and passes it in the `Authorization` header.
140143

141144
## Running tests
142145

0 commit comments

Comments
 (0)