# Basic Auth error but works in incognito (interference with htpasswd in nginx?)

**URL:** <https://community.grafana.com/t/basic-auth-error-but-works-in-incognito-interference-with-htpasswd-in-nginx/33144>\
**Category:** Authentication\
**Created:** [July 4, 2020, 5:56am UTC](https://community.grafana.com/t/basic-auth-error-but-works-in-incognito-interference-with-htpasswd-in-nginx/33144 "2020-07-04T05:56:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![memorysofull](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@memorysofull](https://community.grafana.com/u/memorysofull)\
**Post date:** [July 4, 2020, 5:56am UTC](https://community.grafana.com/t/basic-auth-error-but-works-in-incognito-interference-with-htpasswd-in-nginx/33144/1 "2020-07-04T05:56:58Z")

</div>

Hello, I’m in the process of setting up Grafana after getting Prometheus up and running. Right now I’m running into an issue where if I go to [example.com/grafana](http://example.com/grafana) in my browser, I get this error as a json response:

```auto
{"message":"Invalid username or password"}

```

If I open the page in incognito mode, however, I get the standard login page and the login does work.

I noticed that if I turn `auth.basic` off in `/etc/grafana/grafana.ini`, the login screen does show up and I don’t get the error anymore. However, is this comprising security in any way since this is a public facing page?

I wonder this is related to the basic auth setup I did during the Prometheus installation. While setting up Prometheus, I created a new basic auth login with:

```auto
sudo htpasswd -c /etc/nginx/.htpasswd my_user

```

Could that somehow be interfering with Grafana’s login?

Here is what my Nginx config looks like:

```auto
# Grafana
location /grafana/ {
    proxy_pass http://grafana.staged-by-discourse.com/;
}

# Prometheus
location /prometheus/ {
    auth_basic "Prometheus server authentication";
    auth_basic_user_file /etc/nginx/.htpasswd;
    proxy_pass http://localhost:9090/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

location / {
    root /srv/www/home/;
}

```

Any help will be appreciated! I am really scratching my head here.

---

<div class="post-metadata">

**Author:** ![memorysofull](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@memorysofull](https://community.grafana.com/u/memorysofull)\
**Post date:** [July 8, 2020, 11:52pm UTC](https://community.grafana.com/t/basic-auth-error-but-works-in-incognito-interference-with-htpasswd-in-nginx/33144/2 "2020-07-08T23:52:42Z")

</div>

I don’t think I did anything special, but the error does not happen anymore! Perhaps there was some caching issue that resulted in the error.
