reportportal / service-api

Report portal. Main API Service
Apache License 2.0
46 stars 65 forks source link

Cannot 'activate' a new created user through exposed API #1376

Open istamoulis opened 3 years ago

istamoulis commented 3 years ago

We are trying to use exposed API in order to perform some actions in our reportportal instance.

We are trying to create a new user and then use this new user in order to perform other actions (like creating widjets, dashboards, etc.).

STEPS:

  1. We Create a new user via {url}/api/v1/user.
  2. Then we Create UItoken {url}/uat/sso/oauth/token_. We take the access_token in order to use it for the Get API token call.
  3. We are trying to get the api token through {url}/uat/sso/me/apitoken.

The problem is that we take error: Code 404 - Not Found Body: { "errorCode": 4046, "message": "User 'test' not found."}

As far as we can see, the calls are correct, but it seems that a step is required between steps 2 and 3. To be more precise, if after step-2 we login manually to reportportal, then the step-3 will pass. So, it seems that user is created but not "activated"...

Using reportportal UI As we can see in the UI, the first time we login we can see 2 different apitoken calls. The first one fails with 404, and the second one passes. This is visible in "Network" tab but also in the errors in the "Console", as it is illustrated bellow:

login-manually-1

login-manually-2

ReportPortal version:

docker-images-versions

joelpramos commented 2 years ago

@istamoulis Faced the same problem. If you notice in the network tab the second apitoken call is a POST request instead of a GET. Just make it POST straight up the first time and it'll work. After that GET also works.

been a year so you probably figured that out yourself!

istamoulis commented 2 years ago

@joelpramos thanks for sharing. It has been almost a year, but since we did not use the script so much, we had not found a solution. I just tried the POST before the first GET and indeed it works! Thank you for sharing!