Skip to content

gleam hex authenticate must be run twice to switch accounts. #4319

Open
@hayleigh-dot-dev

Description

@hayleigh-dot-dev

If you hold multiple hex accounts, you might want to replace the local token gleam uses to interact with the hex api from time to time. This consistently fails when changing account details and must always be run a second time to succeed.

Steps to reproduce:

  • run gleam hex authenticate for the first time to generate a local token for hex account A
  • run gleam hex authenticate a second time, confirm that you would like to replace the local token, and provide different credentials for hex account B
  • observe the following error
% gleam hex authenticate

You already have a local Hex API token. Would you like to replace it
with a new one? [y/n]: y
https://hex.pm username: B
https://hex.pm password (will not be printed as you type): 

Please enter a new unique password. This will be used to locally
encrypt your Hex API key.

Local password (will not be printed as you type):
Encrypted Hex API key written to .../gleam/hex/hexpm/credentials
Deleting previous key `...` from Hex
error: Hex API failure

There was a problem when using the Hex API.

This was error from the Hex client library:

    an unexpected response was sent by Hex: 404 Not Found: {"message":"Page not found","status":404}
  • Run gleam hex authenticate a third time exactly the same as above
% gleam hex authenticate

You already have a local Hex API token. Would you like to replace it
with a new one? [y/n]: y
https://hex.pm username: B
https://hex.pm password (will not be printed as you type):

Please enter a new unique password. This will be used to locally
encrypt your Hex API key.

Local password (will not be printed as you type):
Encrypted Hex API key written to .../gleam/hex/hexpm/credentials
Deleting previous key `...` from Hex
  • Observe that the token has successfully been replaced.

You can continue to confirm the issue by attempting to authenticate with hex account A again and observe you must go through the command twice more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions