Git Product home page Git Product logo

Comments (2)

agaudreault avatar agaudreault commented on September 12, 2024

@svianac You can use the ArgoCD CLI with the --sso option to perform these kind of operation. When calling the argo REST API, Ii expects you to already be authenticated and provide the JWT. If you want to use REST instead of the CLI, I believe you will need to manage the Authentication separately to get a bearer token from your identity provider. You can look at the login command implementation for the actual workflow that you would need to replicate with curl.

Once authenticated, the user will be able to perform the same actions that are performed through the UI with normal RBAC.

Let me know if you need more details before closing the issue.

from argo-cd.

svianac avatar svianac commented on September 12, 2024

Hello @agaudreault, thanks for the hint. I actually followed your advice and manage to get the cookie using the API and a SSO user. I have DEX+LDAP for authentication. I will share my workflow to get the token:

1 Step

curl -v "https://$ARGOCD_URL/auth/login"
Here we will store a cookie called argocd.oauthstate and a string called session.

2 Step

curl -v "https://$ARGOCD_URL/api/dex/auth/ad?client_id=argo-cd&redirect_uri=https://$ARGOCD_URL/auth/callback&response_type=code&scope=openid+profile+email+groups&state=$STATE1"
Here we will get a new state string.

3 Step

curl -v "https://$ARGOCD_URL/api/dex/auth/ad/login?back=&state=$STATE2" \ --data-raw 'login=yourLDAPuser&password=yourLDAPpassuser'
Here we will get a code

4 Step

Finally we use the code, first state and the cookie from the beginning
curl -v "https://$ARGOCD_URL/auth/callback?code=$CODE&state=$STATE1" \ -H "Cookie: argocd.oauthstate=$COOKIE"

The token will be given in a cookie called argocd.token

Thanks and please feel free to close the ticket.

I just hope the URLs don't change between versions...

from argo-cd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.