Create API token in Argo CD

This doc helps users to create a token in Argo CD. Argo CD account should have API key permission with RBAC admin role assigned, to generate the token. By Default Argo CD has an Admin account created with RBAC admin permission. If required, create a new account for Argo CD with API Key and RBAC permissions. For detailed information, refer here.

Generate Token from Argo CD UI

  1. In order to generate tokens from Argo CD, your account should have the "API Key’’ permission. If you don't have sufficient permission, please use the following command to update it.

    kubectl patch configmap/argocd-cm --type merge -p '{"data":{"accounts.admin":"apiKey"}}' -n argocd

    Note: Replace the “accounts.admin" in the above command with your account as appropriate.

  2. Login to Argo CD UI. Your Argo CD account should have API Key permission with the RBAC admin role assigned.

  3. In the Application Dashboard, click on the “Settings” icon in the left-side navigation pane and then click on “Accounts”. Refer to the image below.

  4. Select the user and click on “Generate New”. Refer to the image below:

  5. Now you will get a token. Copy that token and encode it to base64 format from your command line. If you are not able to encode it from the command line, use any online encoding site such as https://www.base64encode.org/.

Generate Token from Argo CLI

  1. Login to Argo CD via CLI by executing the below code and provide your username and password when prompted.

    argocd login SERVER
  2. Generate the token to the account by executing the below code.

    argocd account generate-token

    For example, the token in the output appears as shown below.

    eyJhbGciOiJIxxxxxxxxxxxxxxxxxx
  3. After generating the token, copy it and encode it in base64 format from your command line. If you are not able to encode it from the command line, use any online encoding site such as https://www.base64encode.org/.

sss

Last updated