Skip to content

Instantly share code, notes, and snippets.

@nicc777
Last active August 3, 2023 07:01
Show Gist options
  • Save nicc777/72bf4c3cdb6aa6dda6ca39cfaddcd8af to your computer and use it in GitHub Desktop.
Save nicc777/72bf4c3cdb6aa6dda6ca39cfaddcd8af to your computer and use it in GitHub Desktop.
Get ArgoCD API Token

To get the token:

export ARGOCD_SERVER="https://<<your-url>>"
export ARGOCD_ADMIN_PASSWORD=`aws secretsmanager get-secret-value --secret-id SecretText_odde-eks_eks1_argocd_initial-admin-secret --output json | jq -r ".SecretString"`
rm /tmp/creds.json
cat << EOF >> /tmp/creds.json
{
	"username":"admin",
	"password":"$ARGOCD_ADMIN_PASSWORD"
}
EOF
export ARGOCD_TOKEN=`curl -s -X POST -d @/tmp/creds.json $ARGOCD_SERVER/api/v1/session | jq -r ".token"`

Then use IT:

# Get all the deployed application names
curl -s -H "Authorization: Bearer $ARGOCD_TOKEN" $ARGOCD_SERVER/api/v1/applications | jq -r ".items[].metadata.name"

OpenAPI/Swagger UI: $ARGOCD_SERVER/swagger-ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment