-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make API Calls with Token/Robot Account to Harbor #16398
Comments
The robot account does not have permission to create a robot account, you should use the correct account. Here is an example of calling the API:
or
|
Hi @YangJiao0817, Unfortunately, your first statement is not clear to me, how I get the
Furthermore, I have tested our second statements as well. As
The output of this is still
Thanks! |
@AlexBarth13 |
@YangJiao0817 Thanks for the input! Now I was able to create a project in Harbor via curl command.
I have used the following code:
Thanks! |
@AlexBarth13 This is correct, because the robot account does not have permission to create project, you can view the permissions supported by the robot account on the Robot Accounts page. |
@YangJiao0817 For calling the API we don't use an robot account. In all of my tests, I used my personal user + the CLI secret. Thanks! |
@AlexBarth13 To create a project-level robot account, you need to have the project admin permission of the corresponding project or the account is an Administrator, please check your account permissions. |
@YangJiao0817 In the project, where I tested, I am the project administrator. Furthermore, my user is Administrator on the platform. |
@AlexBarth13 ,since the auth mode of your Harbor is OIDC, how did you make it success to create project with API call? As for the OIDC mode, user has to use the A alternative is to enable the debug log of Harbor core, you can get the raw token for it. |
@wy65701436 Thanks a lot for your feedback!
We have used the username + the CLI secret, which I created to my user in the UI. With those credentials, it was working for me as an platform admin as well as for another customer, who is not an admin.
Thanks for this hint! I will check this within our company.
Is there any best practise or documentation about the use of the Harbor API? Furthermore - as an information for you - we in the team started to make an overview of the complete APIs and created test cases to see, which API calls are working - anf if yes, how - or if they are not working. In case we will get some interesting output, I will paste it here. Thanks again! |
@AlexBarth13 do you still have the problem? |
Hi @wy65701436 Thanks a lot! |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
Still an open topics and not yet solved... |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This is still open and needs to be addressed... |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
Hi @wy65701436 and @Vad1mo! Thanks! |
@AlexBarth13 did you try the method as this comment mentioned? If it works at your side, we should file an doc ticket for this issue. |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This is still an open topic - removing stale label... |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This is still an open topic - removing stale label...
|
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue. |
still does not work |
Dear Harbor-Community,
We are using the Harbor registry in our company and we noticed, that API calls (
GET
,PUT
andPOST
) are not working withunauthorized
error message.Our version is v2.4 and Harbor is secured by the company's OIDC and MFA solution.
During a test, were we wanted to create a robot account automatically we noticed this issue. To create the robot account, we have tried with the following credentials:
Here is a example how we tried to call the API:
When we are using the credentials from 1. and 2. - either in plain text with
curl -u
or base64 encoded and as-H 'Authorization
- we are facing this issue:We also get this message when we are creating the bearer token like it is mentioned in the FAQ solution 1.
When we tested the solution 2 in the FAQ, we are not seeing the needed
_xsrf
underSet-Cookies
.Furthermore, we tested the creation of robot accounts from the Swagger UI and this is working fine.
Currently we were not able to find the correct documentation, how we have to authenticate against the API to use it.
How are we able to authenticate correctly and make API calls to Harbor? Is there a solution to this?
Thanks a lot!
Alexander Barth ([email protected]) on behalf of Daimler TSS, Provider Information
The text was updated successfully, but these errors were encountered: