@@ -10,7 +10,9 @@ Wrapper library for Topcoder Submission API
10
10
" topcoder-submission-api-wrapper" : " topcoder-platform/topcoder-submission-api-wrapper.git"
11
11
```
12
12
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:**
14
16
15
17
` ` ` javascript
16
18
const submissionApi = require(' topcoder-submission-api-wrapper' )
@@ -20,7 +22,6 @@ Wrapper library for Topcoder Submission API
20
22
' AUTH0_PROXY_SERVER_URL' ]))
21
23
` ` `
22
24
23
- ** M2M Authentication Configuration:**
24
25
- AUTH0_URL - the auth0 url
25
26
- AUTH0_AUDIENCE - the auth0 audience
26
27
- TOKEN_CACHE_TIME - (optional) the token cache time
@@ -32,27 +33,29 @@ Wrapper library for Topcoder Submission API
32
33
- PER_PAGE - the page size
33
34
- MAX_PAGE_SIZE - the max number of page size
34
35
36
+ ** User Credentials Authentication Configuration:**
37
+
35
38
` ` ` javascript
36
39
const submissionApiUserCredentialsClient = submissionApi(_.pick(config,
37
40
[' USERNAME' , ' PASSWORD' , ' TC_AUTHN_URL' , ' TC_AUTHZ_URL' , ' TC_CLIENT_ID' ,
38
41
' TC_CLIENT_V2CONNECTION' , ' SUBMISSION_API_URL' ]))
39
42
` ` `
40
43
41
- ** User Credentials Authentication Configuration:**
42
44
- USERNAME - Topcoder handle
43
45
- PASSWORD - Topcoder password
44
46
- TC_AUTHN_URL - OAUTH2 token URL, e.g. ` https://topcoder.auth0.com/oauth/ro` or for dev ` https://topcoder-dev.auth0.com/oauth/ro`
45
47
- 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`
46
48
- 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`
48
50
- SUBMISSION_API_URL - Topcoder V5 Submission API URL. E.g. ` https://api.topcoder.com/v5` or for dev ` https://api.topcoder-dev.com/v5`
49
51
52
+ ** JWT Method Argument Authentication Configuration:**
53
+
50
54
` ` ` javascript
51
55
const submissionJwtMethodArgClient = submissionApi(_.pick(config,
52
56
[' SUBMISSION_API_URL' ]))
53
57
` ` `
54
58
55
- ** JWT Method Argument Authentication Configuration:**
56
59
- SUBMISSION_API_URL - Topcoder V5 Submission API URL. E.g. ` https://api.topcoder.com/v5` or for dev ` https://api.topcoder-dev.com/v5`
57
60
58
61
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
136
139
137
140
# # Authorization
138
141
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.
140
143
141
144
## Running tests
142
145
0 commit comments