Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Grant Warning on running hcp #117

Open
kartiklunkad26 opened this issue Jun 18, 2024 · 1 comment
Open

Invalid Grant Warning on running hcp #117

kartiklunkad26 opened this issue Jun 18, 2024 · 1 comment

Comments

@kartiklunkad26
Copy link

When I first upgraded to the hcp v0.3 binary, and I run hcp and get the below warning along with the help description. Is that expected?

I used brew install to do so, and I'm on a MacOS.


➜  workspace hcp
2024/06/18 06:30:38 failed to refresh the token: oauth2: "invalid_grant" "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
USAGE
  hcp <command> [Optional Flags]

DESCRIPTION
  The HCP command-line interface (CLI) is a unified tool to manage your HCP
  services.

COMMAND GROUPS
  auth:           Authenticate to HCP.
  iam:            Manage identity and access management.
  organizations:  Interact with an existing organization.
  profile:        View and edit HCP CLI properties.
  projects:       Create and manage projects.
  vault-secrets:  Manage Vault Secrets.
  waypoint:       Manage HCP Waypoint.

COMMANDS
  version:  Display the HCP CLI version.

GLOBAL FLAGS
  --debug
    Enable debug output.

  --format=FORMAT
    Sets the output format.

  --profile=NAME
    The profile to use. If omitted, the currently selected profile will be used.

  --project=ID
    The HCP Project ID to use. If omitted the current project set in the
    configuration is used.

  --quiet
    Minimizes output and disables interactive prompting.

@dadgar
Copy link
Contributor

dadgar commented Jun 22, 2024

Interesting. Did you by chance edit any files in ~/.config/hcp manually? Any other information you can share about steps you took before running the hcp command that relate to authenticating to hcp?

I was able to reproduce only by manually creating an invalid creds-cache.json.

Things I tried include:

  • Invalidating all sessions via the HCP Portal. That displayed a help message to logout and back in as intended.
  • Modified the creds-cache to inject an invalid refresh token and forcing an expired token. That caused 2024/06/21 18:03:40 failed to refresh the token: oauth2: "invalid_request" "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Make sure that the various parameters are correct, be aware of case sensitivity and trim your parameters. Make sure that the client you are using has exactly whitelisted the redirect_uri you specified."
  • If I replaced the login section of the creds-cache.json with a SP access token and refresh token in the login section, then I saw the error you reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants