# Mender-cli fails to login on EU region

**URL:** <https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252>\
**Category:** General Discussions\
**Tags:** mender-cli\
**Created:** [October 8, 2023, 3:54pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252 "2023-10-08T15:54:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueEcoLine](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BlueEcoLine](https://hub.mender.io/u/BlueEcoLine)\
**Post date:** [October 8, 2023, 3:54pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/1 "2023-10-08T15:54:42Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![mister\_kanister](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mister\_kanister](https://hub.mender.io/u/mister_kanister)\
**Post date:** [October 9, 2023, 3:30pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/2 "2023-10-09T15:30:43Z")

</div>

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`:

```auto
# 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 \

```

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [October 9, 2023, 3:35pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/3 "2023-10-09T15:35:35Z")

</div>

There was an issue with the certificate on [eu.hosted.mender.io](http://eu.hosted.mender.io) today which has been resolved. Is the problem still existing @BlueEcoLine?

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![BlueEcoLine](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BlueEcoLine](https://hub.mender.io/u/BlueEcoLine)\
**Post date:** [October 11, 2023, 8:30am UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/4 "2023-10-11T08:30:06Z")

</div>

> [@mister\_kanister](#):
>
> I would recommend to use a token. Logging in is the old way to perform actions.

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.

> [@TheYoctoJester](#):
>
> There was an issue with the certificate on [eu.hosted.mender.io](http://eu.hosted.mender.io) today which has been resolved. Is the problem still existing @BlueEcoLine?

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

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [October 13, 2023, 6:39am UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/5 "2023-10-13T06:39:04Z")

</div>

Hi @BlueEcoLine,

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

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![BlueEcoLine](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BlueEcoLine](https://hub.mender.io/u/BlueEcoLine)\
**Post date:** [October 13, 2023, 3:51pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/6 "2023-10-13T15:51:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [October 19, 2023, 2:40pm UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/7 "2023-10-19T14:40:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![santiwake](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/santiwake/32/2100_2.png) [@santiwake](https://hub.mender.io/u/santiwake)\
**Post date:** [May 15, 2024, 9:43am UTC](https://hub.mender.io/t/mender-cli-fails-to-login-on-eu-region/6252/8 "2024-05-15T09:43:36Z")

</div>

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.
