hashicorp / vault-plugin-auth-jwt

A Vault plugin to allow authentication via JWT (and OIDC) tokens
Mozilla Public License 2.0
100 stars 61 forks source link

vault CLI does not receive localhost:8250 redirect after auth #190

Open mipnw opened 2 years ago

mipnw commented 2 years ago

I run VAULT_ADDR=https://vault.<mydomain>.io vault login -method=oidc in a shell on MacOS and see Google Chrome open, i'm asked to authenticate with credentials, then the browser redirects to http://localhost:8250/oidc/callback?code=[redacted]&state=[redacted]. Vault CLI however does not seem to receive that code, it eventually times out with

> $ VAULT_ADDR=https://vault.<mydomain>.io vault login -method=oidc
Complete the login via your OIDC provider. Launching browser to:

    https://<mydomain>.okta.com/oauth2/default/v1/authorize?client_id=[redacted]&nonce=[redacted]&redirect_uri=http%3A%2F%2Flocalhost%3A8250%2Foidc%2Fcallback&response_type=code&scope=openid+profile+groups+email&state=[redacted]

Waiting for OIDC authentication to complete...
Error authenticating: Timed out waiting for response from provider

Vault CLI does seem to open listening port 8250 on localhost (before it times out, closes it after the timeout) so I'm puzzled...

$ sudo lsof -i -P | grep LISTEN | grep 8250
vault     42874    <myusername>   10u  IPv4      0t0  TCP localhost:8250 (LISTEN)
kalafut commented 2 years ago

What does chrome say (e.g. the network tab)?

mipnw commented 2 years ago

Chrome displays

This page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE
DrDaveD commented 2 years ago

Pr #30 would probably help with this.