gleam-lang/gleam

`gleam hex authenticate` must be run twice to switch accounts.

Open

#4,319 建立於 2025年3月9日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Rust (960 fork)batch import
discussionhelp wanted

倉庫指標

Star
 (21,417 star)
PR 合併指標
 (平均合併 10天 19小時) (30 天內合併 69 個 PR)

描述

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.

貢獻者指南