# Mender-cli gitlab "Unauthorized. Please Login first"

**URL:** <https://hub.mender.io/t/mender-cli-gitlab-unauthorized-please-login-first/7889>\
**Category:** General Discussions\
**Created:** [July 15, 2025, 2:20pm UTC](https://hub.mender.io/t/mender-cli-gitlab-unauthorized-please-login-first/7889 "2025-07-15T14:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nilso](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nilso](https://hub.mender.io/u/nilso)\
**Post date:** [July 15, 2025, 2:20pm UTC](https://hub.mender.io/t/mender-cli-gitlab-unauthorized-please-login-first/7889/1 "2025-07-15T14:20:04Z")

</div>

Hi,

I am trying to use mender-cli to upload an artifact to the server ( `https://eu.hosted.mender.io/`) but always get the failure “Unauthorized. Please Login first”. Token is a freshly created PAT.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/c/cbb2ea56af817946ddd6efbcf874e41e6f8ddcaf.png)

When testing with the docker container on my WSL it looks similar:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/1/18deef523d631e95fbf3601c4dd03f2e51e94524.png)

I have to enter my user credentials to get logged in… Do I miss something?  
Thanks!  
Nils

---

<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:** [July 16, 2025, 7:53am UTC](https://hub.mender.io/t/mender-cli-gitlab-unauthorized-please-login-first/7889/2 "2025-07-16T07:53:31Z")

</div>

Hi @nilso,

Thanks for reaching out! I tried to reproduce the problem, but only succeeded half:

- the `login` command is not meant to be in conjunction with the PATS, it also falls to username and password for me. Guess the documentation should be clearer here.
- the `mender-cli artifacts upload` using `--server` and `--token-value` flags worked nicely here.

The first thing to hit my mind, is there maybe some problem with shell expansions?

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![nilso](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nilso](https://hub.mender.io/u/nilso)\
**Post date:** [July 16, 2025, 9:16am UTC](https://hub.mender.io/t/mender-cli-gitlab-unauthorized-please-login-first/7889/3 "2025-07-16T09:16:09Z")

</div>

Hi @TheYoctoJester ,  
thanks for clarification. The solution was much easier. We simply used the wrong server 🙈
