Create Jobs in TaaS using user token instead of M2M #626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Verification
Prepare
tc-project-service
I have to add the
https://auth.topcoder-dev.com/
issuer url to the project service, otherwise requests to create new project would got 403 error with message "Invalid token issuer."I was using JWT tokens found on https://topcoder-dev.com.
Configure the
taasJobApiUrl
property atconfig/development.json
with valuehttp://localhost:3000/api/v5/jobs
.Enable debug messages and start the project service.
taas-apis
Clone
taas-apis
onto local machine.Modify the
helper.checkIsMemberOfProject
function(https://github.com/topcoder-platform/taas-apis/blob/dev/src/common/helper.js#L960) so that it can make requests to the project service running locally.That is, replace this line:
with:
Start the taas service.
Check With Regular User
Go to
https://connect.topcoder-dev.com/new-project/taas-jobs
, fill the Form and find the request body on the browser console after the Form is sent.Here is an example:
Go to https://topcoder-dev.com and log in as a regular user. Find the JWT token for the user on the browser console after the user is online.
Create a project via
POST :8001/v5/projects
with the JWT token and the request body.Some log similar to as following could be found on the console:
Fire a request to
GET :3000/api/v5/jobs
, two new records could be found:Repeat step 3 to step 5 and try with other user roles could work as well.