Mender-cli fails to login on EU region

Hi,
an error prevents to connect to Hosted Mender in EU region through cli.
When running mender-cli login --server https://eu.hosted.mender.io, after insering username (the email) and password, pops the following error:

FAILURE: POST /auth/login request failed: Post "https://eu.hosted.mender.io/api/management/v1/useradm/auth/login": x509: certificate has expired or is not yet valid: current time 2023-10-08T17:45:34+02:00 is after 2023-10-08T13:12:41Z

Does anyone knows what could be the problem here?

I would recommend to use a token. Logging in is the old way to perform actions.

From the Mender Dashboard go to account settings and create a PAT (GENERATE A TOKEN). Use this token to perform various tasks. You also can store this token in a save file and fetch it on demand.

Example with --token-value:

# Copy file from a device to your local machine
mender-cli --server $URL --token-value $PAT cp $MENDER_DEVICE_ID:$REMOTE_PATH $LOCAL_PATH

# Upload artifact
mender-cli artifacts upload ./my_artifacts/system-update-0.0.1.mender \
        --server $URL \
        --token-value $PAT \

There was an issue with the certificate on eu.hosted.mender.io today which has been resolved. Is the problem still existing @BlueEcoLine?

Greetz,
Josef

Is there a way to store this token somewere? I’ve made a script to handle it but then the autocompletion doesn’t work anymore.

Yes today the same login command works perfectly, it was just an unlucky day.

Hi @BlueEcoLine,

The long-lived PAT can be generated and managed in the “my profile” section of the Mender dashboard settings.

Greetz,
Josef

Yes thanks, but I mean if is there some configuration file where mender-cli can store it on my system.

Hi @BlueEcoLine,

Unfortunately I don’t think that there is a path to do that in mender-cli yet. I’ll take it to the dev team, it is a good idea to improve the value of the tool, thank you!

Greetz,
Josef

At the moment I use mender-cli devices list --server $SERVER --token-value $TOKEN as well, but should not work with this? $HOME/.mender-clirc ?

For me the .mender-clirc does not work at all.