terraform-provider-argocd icon indicating copy to clipboard operation
terraform-provider-argocd copied to clipboard

rpc error: code = Unauthenticated desc = invalid session: Token is not valid yet when using un/pass

Open md850git opened this issue 1 year ago • 5 comments
trafficstars

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version: 1.6.6
ArgoCD provider version: 6.1.1
ArgoCD version:v2.10.1+a79e0ea

Terraform configuration

provider "argocd" {
  server_addr = local.argo_hostname
  username    = "admin"
  password    = data.aws_secretsmanager_secret_version.mysecret.secret_string
  insecure    = true
  grpc_web    = true
  user_agent  = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"
}

Question

rpc error: code = Unauthenticated desc = invalid session: Token is not valid yet

how do i fix this issue. i can login fine through the console fine with the same admin creds

md850git avatar Oct 09 '24 16:10 md850git

i can login fine through the console fine with the same admin creds

What do you mean by "through the console"? Via the Argo CD CLI client? If so, can you share the command which worked?

mkilchhofer avatar Oct 14 '24 18:10 mkilchhofer

i can login fine through the console fine with the same admin creds

What do you mean by "through the console"? Via the Argo CD CLI client? If so, can you share the command which worked?

I used the gui to login

md850git avatar Oct 14 '24 20:10 md850git

Very strange that you use username and password and it errors something about the token

rpc error: code = Unauthenticated desc = invalid session: Token is not valid yet

mkilchhofer avatar Oct 15 '24 17:10 mkilchhofer

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 15 '24 12:12 github-actions[bot]

I am running into the same issue. I can login through the web console as well as with the argocd cli.

jeremy-rescale avatar Jun 03 '25 15:06 jeremy-rescale

Did anybody find some root cause for this?

I am also running in this issue, login via web UI and argocd cli with the admin account works, but with the provider it fails. The strange thing, everything worked as expected and suddenly it the issue popped up and I can't relate directly which change might triggered this.

Argocd Version: v3.2.0+66b2f30
Provider Version: 7.11.2
OpenTofu v1.9.0

I tried now all kind of different configurations including just using local config, but it always ends with the same error message. Even after redeployment of the argocd helm chart.

I have oidc enabled via azure, but this was also the case before and worked fine. In the meanwhile I have the feeling, the actual error message is not correct and it's some kind of false friend and is related to something else like TLS or some provider internal issues. The server shows this in the logs:

time="2025-11-14T15:56:26Z" level=info msg="finished call" grpc.code=Unauthenticated grpc.component=server grpc.error="rpc error: code = Unauthenticated desc = Invalid username or password" grpc.method=Create grpc.method_type=unary grpc.service=session.SessionService grpc.start_time="2025-11-14T15:56:26Z" grpc.time_ms=547.837 peer.address="10.244.1.238:55934" protocol=grpc
Even when using token login:
`time="2025-11-14T16:20:21Z" level=info msg="finished call" grpc.code=Unauthenticated grpc.component=server grpc.error="rpc error: code = Unauthenticated desc = Invalid username or password" grpc.method=Create grpc.method_type=unary grpc.service=session.SessionService grpc.start_time="2025-11-14T16:20:20Z" grpc.time_ms=777.514 peer.address="10.244.1.238:60322" protocol=grpc`

I couldn't find more in the logs of tofu or argocd server. Unfortunately, I have not deeper knowledge how to debug argocd and the provider. Since it's a test cluster in my case, I am considering to just redeploy the whole cluster to see, if it works on a fresh environment again.

Edit: I saw now, that argocd v3.2 is not fully tested and approved with the provider, so I will also downgrade argocd.

NanoMil avatar Nov 14 '25 16:11 NanoMil

Addendum from my side: After the cluster redeployment, the provider is working again with the previous configuration. The issue was either something in the cluster itself, or the local configuration, or the tokens from the provider that did not got refreshed correctly.

NanoMil avatar Nov 21 '25 09:11 NanoMil